js
//uniapp触底方法
onReachBottom() {
//增加页数
this.page++//调用接口获取数据
this.getBulletin(3)
},
// 获取专栏、公告
getBulletin(e) {
//加载状态
this.loadStatus = 'loading';
this.$H
.post('/post/list', {
cateId: e,
page: this.page
})
.then(res => {
if (res.code == 0 && res.result) {
let list = res.result.data
this.articleList = this.articleList.concat(res.result.data);
//判断是否还有数据
if (res.result.current_page >= res.result.total || res.result.last_page === 0) {
this.loadStatus = 'nomore';
if (list.length == 0 && this.page > 1) {
this.page = this.page - 1
}
} else {
this.loadStatus = 'loadmore';
}
} else {
this.loadStatus = 'nomore';
}
uni.hideLoading();
});
},