From 5dfef883049e7f0670f6c6b1b225b233aee41eea Mon Sep 17 00:00:00 2001 From: inleft <inleft@qq.com> Date: Thu, 03 Mar 2022 01:30:11 +0800 Subject: [PATCH] 评论页刷新策略调整 --- src/components/mini/box12-comment.vue | 40 +++++++++++++++++++--------------------- 1 files changed, 19 insertions(+), 21 deletions(-) diff --git a/src/components/mini/box12-comment.vue b/src/components/mini/box12-comment.vue index da8af57..e2c09c7 100644 --- a/src/components/mini/box12-comment.vue +++ b/src/components/mini/box12-comment.vue @@ -1,12 +1,13 @@ <template> - <div class="myFriend" style="min-height: 950px;"> - <h1 style="text-align: center;">碎碎念</h1> - <replyBox ref="commentBoxId"></replyBox> + <div> + <replyBox ref="commentBoxId" v-bind="$attrs"></replyBox> <a-modal v-model="visible" :title="replyTaget" :footer="null" :bodyStyle="{'overflow':'overlay','maxHeight': '550px','scrollbarWidth': 'none'}"> - <replyBox ref="replyBoxId"></replyBox> + <replyBox ref="replyBoxId" v-bind="$attrs" @sendMsg="sendMsg()"></replyBox> </a-modal> - + <div class="mySecret" style="max-height:350px ;" v-if="commentListData.length==0"> + <p>空空如也..</p> + </div> <div v-for="temp in commentListData" class="commentList"> <div class="commentGroup"> @@ -101,30 +102,28 @@ components: { replyBox }, - beforeMount() { - queryBlogCommentList({ - pageNo: this.page.current, - pageSize: this.page.pageSize, - articleId: this.articleId - }).then((res) => { - this.page.total = Number(res.data.total) - this.page.pageSize = Number(res.data.size); - this.commentListData = res.data.records; - return res - }) - }, methods: { - onChange(current) { - this.page.current = current; + updateCommentList(articleId) { queryBlogCommentList({ pageNo: this.page.current, pageSize: this.page.pageSize, - articleId: this.articleId + articleId: articleId }).then((res) => { this.page.total = Number(res.data.total) this.page.pageSize = Number(res.data.size); this.commentListData = res.data.records; }) + }, + sendMsg() { + this.visible = false; + this.$message.info("列表刷新中..") + setTimeout(() => { + this.updateCommentList(this.$attrs.articleId); + }, 1000); + }, + onChange(current) { + this.page.current = current; + this.updateCommentList(); }, loadMore(temp) { temp.isHasNext = 0; @@ -154,7 +153,6 @@ }, data() { return { - articleId: null, isAllowedComment: true, page: { size: "small", -- Gitblit v1.9.1