上拉加载更多

onReachBottom() {
//上拉加载更多
if (!this.data.canloadMore){
return;//不可以加载更多了
}

this.setData({
playingPage: this.data.playingPage+1
})
// 请求正在热映的电影数据
getPlayingMoive(this.data.playingPage, this.data.playingCount).then(({ result, total }) => {
//设置加载更多得到的数据
let tmp = this.data.playing.concat(result);
//判断是否可以再加载更多
if (this.data.playingPage >= this.data.playTotal){
this.setData({
canloadMore: false,//不可以加载更多
playing: tmp
})
}else{
//可以加载更多
this.setData({
playing: tmp
})
}

})
posted @ 2018-07-11 22:49  海底城  阅读(103)  评论(0编辑  收藏  举报