+
95
-

微信小程序component组件内如何实现onreachbottom触底事件回调?

微信小程序component组件内如何实现onreachbottom触底事件回调?

page里的onreachbottom事件可以使用,但是component里面的呢?

网友回复

+
15
-

wxml

 <scroll-view bindscrolltolower="lower" scroll-y style="height:100vh;"> </scroll-view>

记得将app.wxss的page高度设为100vh

page{
    height:100vh
}
js

 lower() {
    that.getData(); //加载更多数据
 },

为了防止拖动下来后疯狂的加载数据,我们可以增加一个函数节流

在utils目录中新建util.js,内容如下:

function throttle(fn, gapTime) {
    if (gapTime == null || gapT...

点击查看剩余70%

我知道答案,我要回答