在需要上拉加载的页面的page.json上添加红框框里面的
onReachBottom() {if(this.commentCurrent<this.commentTotal){this.commentCurrent += 1; this.commentList();this.status = 'loading';}else{this.status = '';}
},
methods:{commentList(){let params = {courseid:this.courseid,page:this.commentCurrent}commentList(params).then((res)=>{let {code,list,numpage} = resif(code==0){//如果页数>1,需要拼接返回的数据if (this.commentCurrent > 1) {list = [...this.commentData, ...list];}this.commentData = listthis.commentTotal = numpageuni.stopPullDownRefresh(); //拿到数据后,停止下拉刷新this.status = '';}})},
}