Skip to content
Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ export class TaroHarmonyHybridIntersectionObserver implements Taro.IntersectionO
}

public relativeToViewport (margins?: Taro.IntersectionObserver.RelativeToViewportMargins | undefined): Taro.IntersectionObserver {
return this.relativeTo('.taro_page', margins)
return this.relativeTo('.taro_router', margins)
}

private _getCallbackByElement (element: Element) {
Expand Down