Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

解决IntersectionObserver相关接口无效问题 #598

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions examples/mini-program-example/src/pages/api/wxml/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ class IntersectionObserverTest extends React.Component {
this.observer = undefined
}
this.observer = this.createIntersectionObserver(data)
TestConsole.consoleResult.call(this, this.observer, apiIndex)
TestConsole.consoleResult.call(this, "createIntersectionObserver:ok", apiIndex)
},
},
{
Expand All @@ -282,8 +282,8 @@ class IntersectionObserverTest extends React.Component {
this.observer.disconnect()
}
this.observer = this.createIntersectionObserver()
this.observer.relativeTo('.scroll-view', data).observe('.ball', (res) => {
TestConsole.consoleOnCallback.call(this, res, 'IntersectionObserver.observe', apiIndex)
this.observer.relativeTo('#IntersectionObserver', data).observe('.ball', (res) => {
TestConsole.consoleOnCallback.call(this, res, 'IntersectionObserver.relativeTo', apiIndex)
this.setState({
appear: res.intersectionRatio > 0,
})
Expand All @@ -296,13 +296,13 @@ class IntersectionObserverTest extends React.Component {
left: 0,
},
func: (apiIndex, data) => {
TestConsole.consoleTest('IntersectionObserver.relativeTo')
TestConsole.consoleTest('IntersectionObserver.relativeToViewport')
if (this.observer) {
this.observer.disconnect()
}
this.observer = this.createIntersectionObserver()
this.observer.relativeToViewport(data).observe('.ball', (res) => {
TestConsole.consoleOnCallback.call(this, res, 'IntersectionObserver.observe', apiIndex)
TestConsole.consoleOnCallback.call(this, res, 'IntersectionObserver.relativeToViewport', apiIndex)
this.setState({
appear: res.intersectionRatio > 0,
})
Expand Down Expand Up @@ -338,7 +338,7 @@ class IntersectionObserverTest extends React.Component {
return (
<View>
<View style={{ fontSize: '30px', textAlign: 'center' }}>IntersectionObserver测试</View>
<ScrollView className='scroll-view' scrollY>
<ScrollView id='IntersectionObserver' className='scroll-view' scrollY>
<View className='scroll-area' style={{ background: appear ? '#0f0' : '' }}>
<Text className='notice'>先创建IntersectionObserver再滚动</Text>
<View className='filling'></View>
Expand Down