<mescroll-body ref="mescrollRef" @init="mescrollInit" :down="{
use: false
}" @up="upCallback" :up="{
textNoMore: '-- 我也是有底线的!! --'
}">
async mescrollInit() {
await this.loadArticleCommentList()
this.isInit = false;
this.getMescroll().endSuccess();
console.log(`当获取到的评论数量:${this.commentList.length}, 全部的评论数量:${this.commentListTotal}`)
this.getMescroll().endBySize(this.commentList.length, this.commentListTotal);
},
async upCallback() {
if (this.isInit) return;
this.page += 1;
await this.loadArticleCommentList();
this.getMescroll().endSuccess();
console.log(`当获取到的评论数量:${this.commentList.length}, 全部的评论数量:${this.commentListTotal}`)
this.getMescroll().endBySize(this.commentList.length, this.commentListTotal);
},
getMescroll() {
if (this.$refs.mescrollRef) {
this.mescroll = this.$refs.mescrollRef.mescroll
}
return this.mescroll;
},
async loadArticleCommentList() {
const {
data: res
} = await getArticleCommentList({
articleId: this.articleId,
page: this.page,
size: this.size
})
this.commentListTotal = res.count;
if (this.page === 1) {
this.commentList = res.list
} else {
this.commentList = [...this.commentList, ...res.list]
}
},