diff --git a/pages/component/scroll-view/scroll-view-props.test.js b/pages/component/scroll-view/scroll-view-props.test.js index d54c3bd0c804632d8975f798174e23f94b2e41e2..7aebdf439e4629ec2232cd3cb19c04917c170be4 100644 --- a/pages/component/scroll-view/scroll-view-props.test.js +++ b/pages/component/scroll-view/scroll-view-props.test.js @@ -24,6 +24,10 @@ describe('component-native-scroll-view-props', () => { scrollTop: 600 }) await page.waitFor(600) + //检测滚动top 是否触发scroll 事件 + const scrollChangeTop = await page.data('scrollChangeTop') + console.log("scrollChangeTop="+scrollChangeTop) + expect(scrollChangeTop-600).toBeGreaterThanOrEqual(0) const element = await page.$('#scrollViewY') const scrollTop = await element.property("scrollTop") console.log("check_scroll_top---"+scrollTop) diff --git a/pages/component/scroll-view/scroll-view-props.uvue b/pages/component/scroll-view/scroll-view-props.uvue index 8a27e04f6dd249590e804982488be3f6cc4e74e3..8d763b3d85225d67fc55f5b6b0af08a91f07d74b 100644 --- a/pages/component/scroll-view/scroll-view-props.uvue +++ b/pages/component/scroll-view/scroll-view-props.uvue @@ -95,7 +95,8 @@ scrollY: true, bounces: false, scrollTop: 0, - scrollLeft: 0, + scrollLeft: 0, + scrollChangeTop: 0, scrollIntoView: "", enableBackToTop: false, scrollWithAnimation: false, @@ -171,7 +172,8 @@ scrolltolower() { console.log("滚动到底部"); }, - scroll(e : ScrollEvent) { + scroll(e : ScrollEvent) { + this.scrollChangeTop = e.detail.scrollTop console.log("scroll-top : " + e.detail.scrollTop + " scroll-left : " + e.detail.scrollLeft); }, scrollend() {