From cac01d8aa1fe61015957e66e234d88c15ef62758 Mon Sep 17 00:00:00 2001 From: yige Date: Wed, 8 Jul 2020 23:44:33 +0800 Subject: [PATCH] =?UTF-8?q?add:=20=E7=BC=96=E8=BE=91=E5=99=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/post/_id.vue | 48 ++++++++++++++++++++++++++++++---------------- 1 file changed, 32 insertions(+), 16 deletions(-) diff --git a/pages/post/_id.vue b/pages/post/_id.vue index 3187afd..9830991 100644 --- a/pages/post/_id.vue +++ b/pages/post/_id.vue @@ -32,13 +32,24 @@ div .comment-author {{ item.comment_author }} .comment-content {{ item.comment_content }} .comment-info {{ item.comment_date }} - span.reply 回复 - p(v-if="!comments.length", style="color: #cecece; text-align: center; margin-top: 40px") 暂无 - .comment-userinfo - .comment-avatar - img(:src="'https://picsum.photos/100/100/?blur=1'") - .comment-nickname 张三 - #editor + span.reply(@click="reply(item.comment_ID)") 回复 + .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") + .comment-area + .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)") 回复 + p(v-if="!comments.length", style="color: #cecece; text-align: center; margin-top: 40px") 暂无内容 + .comment-default-commit + .comment-userinfo + .comment-avatar + img(:src="'https://picsum.photos/100/100/?blur=1'") + .comment-nickname 张三 + #editor + .comment-default-commit(v-show="replyID") + #editor-reply ins.adsbygoogle(style="display:block; text-align:center; margin-top:20px;", data-ad-layout="in-article", data-ad-format="fluid", data-ad-client="ca-pub-2143583075951360", data-ad-slot="4741804954") .articelRightToc(v-show="articels.post_toc_show && showRightToc", @click="articelRightTocClick") .articelTitle 目录 @@ -78,14 +89,15 @@ export default { comments, commentAmount, showRightToc: false, - tocIds: result.post_toc_ids + tocIds: result.post_toc_ids, + replyID: null } }, mounted () { // 创建编辑器 if (process.client) { if (!window.editorObj && window.Vditor) { - window.editorObj = new window.Vditor('editor', { + const editorConfig = { toolbar: [ 'emoji', 'headings', @@ -131,9 +143,9 @@ export default { enable: true }, placeholder: '我们书写的不是代码,而是人生' - }) - // window.editorObj.customConfig.uploadImgShowBase64 = true // 使用 base64 保存图片 - // window.editorObj.create() + } + window.editorObj = new window.Vditor('editor', editorConfig) + window.editorReplyObj = new window.Vditor('editor-reply', editorConfig) } } @@ -311,6 +323,9 @@ export default { title: '感谢支持', text: '' }) + }, + reply (id) { + this.replyID = id } }, head () { @@ -393,8 +408,8 @@ export default { margin-bottom 30px .comment-item - margin-top 20px - margin-left 10px + margin-top 10px + padding 10px 8px .comment-avatar float left @@ -428,7 +443,8 @@ export default { .comment-userinfo margin-top 90px - margin-left 10px + margin-left 5px + padding 10px 5px .comment-avatar float left @@ -449,7 +465,7 @@ export default { line-height 70px #editor - margin-top 20px + margin-top 10px margin-bottom 10px .btnFooter