评论组件增加文章作者标识

This commit is contained in:
x ronger 2020-09-29 18:26:08 +08:00
parent d8db0f2581
commit e8fbc3f2af
2 changed files with 25 additions and 8 deletions

View File

@ -53,13 +53,23 @@
<el-link rel="nofollow" :underline="false" title="查看原评论"
@click.native="toggleShowOriginalComment(comment.commentOriginalCommentId)"><i
class="el-icon-reading"></i> 查看原评论</el-link>
<el-tag v-show="isAuthor(comment.commentAuthorId)" size="mini" effect="plain" style="margin-left: 5px;">
作者
</el-tag>
</el-col>
</el-col>
<el-col v-show="!comment.commentOriginalCommentId">
<el-col :span="16">
<el-link rel="nofollow" @click="onRouter('user', comment.commenter.userNickname)" :underline="false"
class="text-default">{{ comment.commenter.userNickname }}
</el-link>
</el-col>
<el-col :span="8" class="text-right" style="padding-right: 1rem;">
<el-tag v-show="isAuthor(comment.commentAuthorId)" size="mini" effect="plain" style="margin-left: 5px;">
作者
</el-tag>
</el-col>
</el-col>
</el-col>
<el-col style="padding: 1rem;">
<el-col>
@ -107,6 +117,10 @@
type: Object,
default: false
},
authorId: {
type: Number,
default: false
},
avatar: {
type: String,
default: ''
@ -335,6 +349,9 @@
} else {
ele.style.display = 'none';
}
},
isAuthor(commentAuthorId) {
return this.authorId === commentAuthorId;
}
},
async mounted() {

View File

@ -76,7 +76,7 @@
</el-col>
<el-col>
<comment-box :fetching="isFetching" :user="user" :avatar="avatar" :title="article.articleTitle"
:post-id="routeArticleId"></comment-box>
:post-id="routeArticleId" :authorId="article.articleAuthorId"></comment-box>
</el-col>
<el-col>
<el-dialog :visible.sync="dialogVisible">