1.在pages.json里面找到你需要开启的那个页面,加上"onReachBottomDistance": 50
{
"path": "pages/profit/definite/index",
"style": {
"navigationBarTitleText": "佣金明细",
"enablePullDownRefresh": false,
"onReachBottomDistance": 50//50代表距离底部多少的距离 这个根据自己的需求 一般都是50
}
},
2.在页面 methods中 添加onReachBottom() //上拉触底事件
onReachBottom() { //上拉触底事件 距离底部50px的时候会触发
if (this.list.length < this.total) {
this.page++
commissionList({
page: this.page
}).then(res => {
this.newlist = res.data.data
this.list = [...this.list, ...this.newlist]
})
}
},