uniapp使用scroll-view嵌套时不触发滚动事件
参考链接:
- 微信文档:https://developers.weixin.qq.com/miniprogram/dev/component/scroll-view.html
- uniapp文档: https://uniapp.dcloud.net.cn/component/scroll-view.html
布局代码:
<scroll-view scroll-y class="scroll-box" bindscrolltolower="scrollToBottom"> <view> <view v-for="item in 30">{{ item }}: test scroller-view 滚动到底部事件</view> </view> </scroll-view>
scrollToBottom(e) { console.log('e', e); console.log("scroller-view 滚动到底部事件"); }
.scroll-box { background-color: antiquewhite; width: 100%; height: 500px; }
刚开始按照微信文档设置了 bindscrolltolower="scrollToBottom" 方法但不触发,
增加了 lower-threshold='100' 也不触发。

后来发现微信文档和uniapp文档不一样。
微信文档:

uniapp文档:

把绑定方法的属性从微信文档的写法改成uniapp的写法就可以了 @scrolltolower="scrollToBottom"


浙公网安备 33010602011771号