fix weixin-app, add this type to intersection observer (#28754)

This commit is contained in:
Jiayu Liu
2018-09-11 05:35:04 +08:00
committed by Ryan Cavanaugh
parent c86f6b0ccf
commit 0a583cbe13
4 changed files with 4142 additions and 4150 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -1,25 +1,18 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6",
"dom"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true,
"esModuleInterop": true
},
"files": [
"index.d.ts",
"weixin-app-tests.ts"
]
}
"compilerOptions": {
"module": "commonjs",
"lib": ["es6", "dom"],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": ["../"],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true,
"esModuleInterop": true
},
"files": ["index.d.ts", "weixin-app-tests.ts"],
"exclude": [".prettierrc"]
}

View File

@@ -1,7 +1,7 @@
{
"extends": "dtslint/dt.json",
"rules": {
"no-any-union": false,
"no-unnecessary-generics": false
}
}
"extends": "dtslint/dt.json",
"rules": {
"no-any-union": false,
"no-unnecessary-generics": false
}
}

View File

@@ -2,11 +2,11 @@ getCurrentPages();
interface MyOwnEvent
extends wx.CustomEvent<
"my-own",
{
hello: string;
}
> { }
"my-own",
{
hello: string;
}
> {}
let behavior = Behavior({
behaviors: [],
@@ -18,7 +18,7 @@ let behavior = Behavior({
data: {
myBehaviorData: ""
},
attached() { },
attached() {},
methods: {
myBehaviorMethod() {
const s: string = this.data.myBehaviorData;
@@ -57,7 +57,7 @@ Component({
attached() {
wx.setEnableDebug({
enableDebug: true,
success(res) { }
success(res) {}
});
wx.reportMonitor("123", 123);
@@ -66,6 +66,10 @@ Component({
wx.getLogManager().log("123");
wx.getLogManager().warn("123");
wx.getLogManager().debug("123");
this.createIntersectionObserver({}).observe("123", res => {
res.id;
});
},
detached() {
@@ -73,14 +77,14 @@ Component({
{
key: null
},
() => { }
() => {}
);
}
},
pageLifetimes: {
show() { },
hide() { }
show() {},
hide() {}
},
// 生命周期函数可以为函数或一个在methods段中定义的方法名
@@ -89,13 +93,13 @@ Component({
{
key: "123"
},
() => { }
() => {}
);
},
moved() { },
moved() {},
detached() { },
detached() {},
methods: {
readMyDataAndMyProps() {
@@ -188,21 +192,19 @@ Page({
}
};
},
onPageScroll: () => {
// this.
// Do something when page scroll
wx.createIntersectionObserver()
.relativeToViewport()
.observe("div", res => {
console.log(res.id);
console.log(res.dataset);
console.log(res.intersectionRatio);
console.log(res.intersectionRect.left);
console.log(res.intersectionRect.top);
console.log(res.intersectionRect.width);
console.log(res.intersectionRect.height);
})
.disconnect();
onPageScroll() {
wx.createIntersectionObserver(this, {})
.relativeToViewport()
.observe("div", res => {
console.log(res.id);
console.log(res.dataset);
console.log(res.intersectionRatio);
console.log(res.intersectionRect.left);
console.log(res.intersectionRect.top);
console.log(res.intersectionRect.width);
console.log(res.intersectionRect.height);
})
.disconnect();
},
onTabItemTap(item: any) {
this.setData({