方法一
使用scroll-view中的lower threshold
.wxml
<scroll-view class="content"
scroll-y="true"
lower-threshold="100"
bindscrolltolower="scrollToLower">
<view class="item" wx:for="{{list}}" wx:key='key'></view>
</scroll-view>
.js
Page({
data: {
getMore: true,/*是否可以获取更多订单*/
},
scrollToLower() {
if (this.data.getMore) {
this.getMore()
}
else {
console.log('no more')
},
getMore(){
/*列表接口*/
}
},
方法二
小程序自带onReachBottom()方法
.js
Page({
data: {
getMore: true,/*是否可以获取更多订单*/
},
onReachBottom: function () {
if(this.data.getMore){
this.getMore()
}
},
getMore(){
/*列表接口*/
}
},
.json
{
"onReachBottomDistance":200
}