|
|
@@ -2,28 +2,34 @@
|
|
|
<div class="comment-item" :class="{ 'sub-comment-item': isSubComment }">
|
|
|
<div class="comment">
|
|
|
<!-- 评论或回复人头像 -->
|
|
|
- <img
|
|
|
- class="avatar"
|
|
|
- :src="comment.user.avatar || ''"
|
|
|
- @error="(e) => e.target.classList.add('error')"
|
|
|
- />
|
|
|
+ <router-link :to="`/u/${comment.user.userId}`">
|
|
|
+ <img
|
|
|
+ class="avatar"
|
|
|
+ :src="comment.user.avatar || ''"
|
|
|
+ @error="(e) => e.target.classList.add('error')"
|
|
|
+ >
|
|
|
+ </router-link>
|
|
|
<div class="content-box">
|
|
|
- <!-- 评论或回复人具体信息 -->
|
|
|
- <div class="meta-box">
|
|
|
- <slot name="userMeta">
|
|
|
- <div class="user-popover-box">
|
|
|
+ <router-link :to="`/u/${comment.user.userId}`">
|
|
|
+ <!-- 评论或回复人具体信息 -->
|
|
|
+ <div class="meta-box">
|
|
|
+ <slot name="userMeta">
|
|
|
+ <div class="user-popover-box">
|
|
|
<span v-if="comment.user">{{
|
|
|
comment.user.name +
|
|
|
- (comment.user.author === true ? '(作者)' : '')
|
|
|
+ (comment.user.author === true ? '(作者)' : '')
|
|
|
}}</span>
|
|
|
- </div>
|
|
|
- </slot>
|
|
|
- </div>
|
|
|
+ </div>
|
|
|
+ </slot>
|
|
|
+ </div>
|
|
|
+ </router-link>
|
|
|
|
|
|
<!-- 评论或回复内容 -->
|
|
|
<div class="content">
|
|
|
- <span v-if="comment.reply" class="reply"
|
|
|
- >回复
|
|
|
+ <span
|
|
|
+ v-if="comment.reply"
|
|
|
+ class="reply"
|
|
|
+ >回复
|
|
|
<span class="reply-target" :title="comment.reply.email">{{
|
|
|
comment.reply.name + ':'
|
|
|
}}</span>
|
|
|
@@ -33,7 +39,7 @@
|
|
|
<img
|
|
|
:src="comment.imgSrc || ''"
|
|
|
@error="(e) => e.target.classList.add('error')"
|
|
|
- />
|
|
|
+ >
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
|
@@ -42,8 +48,7 @@
|
|
|
<time
|
|
|
:title="formatTime(comment.createAt, true)"
|
|
|
:datetime="comment.createAt"
|
|
|
- >{{ formatTime(comment.createAt) }}</time
|
|
|
- >
|
|
|
+ >{{ formatTime(comment.createAt) }}</time>
|
|
|
<div
|
|
|
v-if="user.author === true"
|
|
|
class="delete"
|
|
|
@@ -117,25 +122,25 @@ export default {
|
|
|
comment: {
|
|
|
type: Object,
|
|
|
default: () => {},
|
|
|
- required: true,
|
|
|
+ required: true
|
|
|
},
|
|
|
id: {
|
|
|
type: [String, Number],
|
|
|
- required: true,
|
|
|
+ required: true
|
|
|
},
|
|
|
parent: {
|
|
|
type: Object,
|
|
|
- default: () => {},
|
|
|
+ default: () => {}
|
|
|
},
|
|
|
user: {
|
|
|
type: Object,
|
|
|
- default: () => {},
|
|
|
- },
|
|
|
+ default: () => {}
|
|
|
+ }
|
|
|
},
|
|
|
computed: {
|
|
|
isSubComment() {
|
|
|
return this.id.split('-').length === 3
|
|
|
- },
|
|
|
+ }
|
|
|
},
|
|
|
methods: {
|
|
|
formatTime(time, local = false) {
|
|
|
@@ -162,8 +167,8 @@ export default {
|
|
|
default:
|
|
|
return Math.floor(diff / 3600 / 24 / 365) + '年前'
|
|
|
}
|
|
|
- },
|
|
|
- },
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
</script>
|
|
|
|