data(){
return{
pages: 1, //页数
totalCount: ‘’, //列表总数
totalPage: ‘’, //总页数
}
}
getpiao(){
if (res.data.code == 100) {
that.totalCount = res.data.thePage.sumCount;
// 如果总数除以limit 余数为0 说明没有下一页了
if (res.data.thePage.sumCount % 10 === 0) {
that.totalPage = parseInt(res.data.thePage.sumCount / 10);
} else {
that.totalPage = parseInt((res.data.thePage.sumCount / 10)) + 1;
}
if (that.pages == 1) {
that.pro = res.data.data;
} else {
that.pro = that.pro.concat(res.data.data);
}
}
}
//上拉触底事件
onReachBottom() {
if (this.pages >= this.totalPage) {
uni.showToast({
icon: ‘none’,
title: ‘没有更多数据了’
})
return
}
// 加载更多数据
this.pages++;
this.getpiao(); //调用接口数据
},