数据没有全部加载完毕就展示了底线视图

来源:8-16 评论列表 - 处理数据加载完成的提示

雪豹闭嘴

2022-11-11

<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]
				}
			},

图片描述

写回答

2回答

Sunday

2022-11-11

你好

这个问题可以查看下该问答:https://coding.imooc.com/learn/questiondetail/2JZ90XeeLA7XarpL.html 

该问题出现的原因可以查看该问答:

https://coding.imooc.com/learn/questiondetail/x5yVlYm4V92P4g0R.html 

0
2
雪豹闭嘴
非常感谢!
2022-11-11
共2条回复

雪豹闭嘴

提问者

2022-11-11

解决了

this.getMescroll().endSuccess(this.commentList.length, this.commentList.length < this.commentListTotal);

//img.mukewang.com/szimg/636dee4d094bed7f35842240.jpg

0
1
潜行的夜猫子
确实有效!感谢
2023-11-20
共1条回复

uni-app从入门到进阶 系统完成项目实战

专门为小程序0基础学员而设,让你拥有能上线的作品

1105 学习 · 743 问题

查看课程