scroll-view上下触顶或触底重复的解决方案。
发布于 4 年前 作者 yaoxia 2441 次浏览 来自 分享

scroll-view wxml需要加的:

upper-threshold="150" bindscrolltoupper="gotop" lower-threshold="150" bindscrolltolower="gobottom"  bindtouchend="end_fn"

触底会触发gobottom

下拉会触发gotop

这2个方法结束的时候写一个全局变量 x = top 或者 x = bottom

bindtouchend 触摸结束的时候读取 x 的值,如果是 top 就处理对应的事务。

网上很多稀奇古怪的方法,比如触摸计算距离等等。。。

这个方法可以避免重复问题,并且代码量少。

回到顶部