uniapp下滑分页获取更多
data中
data() {
return {
page: 1,
total: 0,
list: [],
};
},
数据接口
// 调用数据
getList() {
let that = this
Supplier.getList({
page: that.page,
limit: 10,
}, function(res) {
that.list = [...that.list, ...res.data];
that.total = res.total
})
},
触底事件
onReachBottom() {
if (this.total < 10) return;
if (this.page * 10 >= this.total) {
return uni.showToast({
title: "数据加载完毕!",
icon: 'none'
})
}
this.page++;
this.getList()
},