第一步:scroll-y 允许纵向滚动, bindscrolltolower 定义了滚动到底部时应该执行的函数, 参考下面代码:
<scroll-view scroll-y bindscrolltolower='toLow' style="height: {{height}}px">
|
第二步:style 中使用了 js 中获取的屏幕可用高度 使用 scroll-y 需要指定 scroll 的高度,参考如下代码:
onLoad: function (options) {
wx.getSystemInfo({
success: (res) => {
this.setData({
height: res.windowHeight
})
}
})
},
toLow(){
this.setData({
isLoading: true
})
},
|
第三步:然后在 scroll 下面放你的 loading 组件就可以了..
<scroll-view scroll-y bindscrolltolower='toLow' style="height: {{height}}px">
......
<view hidden="{{!isLoading}}">
<Loading></Loading>
</view>
</scroll-view>
|