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
两个ScrollView嵌套导致scrollTop不可控,外面滚动里面会不停render #7626
Comments
@ZakaryCode 看了下 @tarojs/component/scroll-view/index.js ,debug看了下,一个页面创建了多个ScrollView 实例,当滚动其中一个ScrollView 其他实例都会render 是这个问题吗? |
根据提供的示例,你并没有监听内层 |
方便的话补充下示例代码,以便调试。 |
|
未能复现到该问题,如无更多信息,issue 将关闭。 |
是的,内部是scrollView 没有监听滚动事件,我试试看 |
解决了,不能算bug吧,但存在一些使用上的限制,或者说写法上有些注意事项。总结下: |
taro3 小程序有同样问题 |
请认真阅读文档,查看组件使用方法。
|
就是bug,我两个scrollviw,两个都写上onScroll监听,里面的那个监听还是会执行到外层scrollview的监听方法,即使写同一个方法,我通过传参判断,它也是会执行两遍,不传参数就会只一次,但是就没法判断是哪个盒子,taro3.x也不支持自定义属性,所以我现在根本没法判断是哪个盒子滚动。我的版本是3.0.11 |
请注意该 issue 讨论的范围限制于 2.x,如若 3.x 有同样的问题请在新的 issue 提交可复现的 demo,并引用该 issue。 |
我也遇到了这个问题,请问解决了吗 |
内层的scroview 需要 阻止冒泡事件 就好了 |
相关平台
H5
复现仓库
https://gist.github.com/1c2f020ddbe986c56e0006a6615d9825
浏览器版本: Chrome 77.0.3865.120
使用框架: React
复现步骤
1.两个ScrollView嵌套,外层监听onScroll事件 ,并设置外层scrollTop.
2.内部的ScrollView 设置scrollLeft
期望结果
内外层ScrollView互不影响
实际结果
外层scrollView 滚动,会不停render内部组件,并且会影响内部ScrollViewScrollLeft的定位
环境信息
The text was updated successfully, but these errors were encountered: