From 1d26c243be962fd03a2c71f704c09936e4cddba4 Mon Sep 17 00:00:00 2001 From: yige Date: Thu, 9 Jul 2020 00:01:48 +0800 Subject: [PATCH] =?UTF-8?q?add:=20=E5=9B=9E=E5=A4=8D=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/post/_id.vue | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/pages/post/_id.vue b/pages/post/_id.vue index 9830991..af7b8f9 100644 --- a/pages/post/_id.vue +++ b/pages/post/_id.vue @@ -32,7 +32,8 @@ div .comment-author {{ item.comment_author }} .comment-content {{ item.comment_content }} .comment-info {{ item.comment_date }} - span.reply(@click="reply(item.comment_ID)") 回复 + span.reply(@click="reply(item.comment_ID, null, true)" v-if="replyLastID === null && item.comment_ID === replyID") 取消回复 + span.reply(@click="reply(item.comment_ID, null)" v-else) 回复 .comment-item(v-for="(i, inx) in item.children", :key="inx", style="margin-top: 15px; margin-left: 50px; background-color: #eeeeee; border-radius: 4px;") .comment-avatar img(:src="i.comment_author_avatar_url ? i.comment_author_avatar_url : 'https://picsum.photos/100/100/?blur=' + i.user_id") @@ -40,7 +41,8 @@ div .comment-author {{ i.comment_author }} .comment-content {{ i.comment_content }} .comment-info {{ i.comment_date }} - span.reply(@click="reply(item.comment_ID, i.comment_ID)") 回复 + span.reply(@click="reply(item.comment_ID, i.comment_ID)" v-if="replyLastID !== i.comment_ID") 回复 + span.reply(@click="reply(item.comment_ID, i.comment_ID, true)" v-else) 取消回复 p(v-if="!comments.length", style="color: #cecece; text-align: center; margin-top: 40px") 暂无内容 .comment-default-commit .comment-userinfo @@ -90,6 +92,7 @@ export default { commentAmount, showRightToc: false, tocIds: result.post_toc_ids, + replyLastID: null, replyID: null } }, @@ -324,8 +327,14 @@ export default { text: '' }) }, - reply (id) { - this.replyID = id + reply (id, replyLastID, cancel) { + if (cancel) { + this.replyID = null + this.replyLastID = null + } else { + this.replyID = id + this.replyLastID = replyLastID + } } }, head () { @@ -565,6 +574,9 @@ footer .footer cursor pointer margin auto +.vditor--fullscreen + z-index 9999999 + @media (max-width: 768px) .articleDetails padding 20px