提交 532493d4 编写于 作者: shutao-dc's avatar shutao-dc

增加scroll-top检测scroll触发自动检测

上级 64dce247
...@@ -24,6 +24,10 @@ describe('component-native-scroll-view-props', () => { ...@@ -24,6 +24,10 @@ describe('component-native-scroll-view-props', () => {
scrollTop: 600 scrollTop: 600
}) })
await page.waitFor(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 element = await page.$('#scrollViewY')
const scrollTop = await element.property("scrollTop") const scrollTop = await element.property("scrollTop")
console.log("check_scroll_top---"+scrollTop) console.log("check_scroll_top---"+scrollTop)
......
...@@ -95,7 +95,8 @@ ...@@ -95,7 +95,8 @@
scrollY: true, scrollY: true,
bounces: false, bounces: false,
scrollTop: 0, scrollTop: 0,
scrollLeft: 0, scrollLeft: 0,
scrollChangeTop: 0,
scrollIntoView: "", scrollIntoView: "",
enableBackToTop: false, enableBackToTop: false,
scrollWithAnimation: false, scrollWithAnimation: false,
...@@ -171,7 +172,8 @@ ...@@ -171,7 +172,8 @@
scrolltolower() { scrolltolower() {
console.log("滚动到底部"); 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); console.log("scroll-top : " + e.detail.scrollTop + " scroll-left : " + e.detail.scrollLeft);
}, },
scrollend() { scrollend() {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册