mirror of https://github.com/halo-dev/halo
feat: performance optimization.
parent
7bf71eb919
commit
676868904e
|
@ -111,13 +111,13 @@ export default {
|
||||||
computed: {
|
computed: {
|
||||||
converttedPostComments() {
|
converttedPostComments() {
|
||||||
return this.postComments.map(comment => {
|
return this.postComments.map(comment => {
|
||||||
comment.content = marked(comment.content, { sanitize: true })
|
comment.content = marked(comment.content)
|
||||||
return comment
|
return comment
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
converttedSheetComments() {
|
converttedSheetComments() {
|
||||||
return this.sheetComments.map(comment => {
|
return this.sheetComments.map(comment => {
|
||||||
comment.content = marked(comment.content, { sanitize: true })
|
comment.content = marked(comment.content)
|
||||||
return comment
|
return comment
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -556,7 +556,7 @@ export default {
|
||||||
formattedComments() {
|
formattedComments() {
|
||||||
return this.comments.map(comment => {
|
return this.comments.map(comment => {
|
||||||
comment.statusProperty = this.commentStatus[comment.status]
|
comment.statusProperty = this.commentStatus[comment.status]
|
||||||
comment.content = marked(comment.content, { sanitize: true })
|
comment.content = marked(comment.content)
|
||||||
return comment
|
return comment
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
<a-menu-item key="1">
|
<a-menu-item key="1">
|
||||||
<span
|
<span
|
||||||
href="javascript:void(0);"
|
href="javascript:void(0);"
|
||||||
@click="handleEditStatusClick(comment,'PUBLISHED')"
|
@click="handleEditStatusClick('PUBLISHED')"
|
||||||
>通过</span>
|
>通过</span>
|
||||||
</a-menu-item>
|
</a-menu-item>
|
||||||
<a-menu-item key="2">
|
<a-menu-item key="2">
|
||||||
|
@ -22,13 +22,13 @@
|
||||||
|
|
||||||
<span
|
<span
|
||||||
v-else-if="comment.status === 'PUBLISHED'"
|
v-else-if="comment.status === 'PUBLISHED'"
|
||||||
@click="handleReplyClick(comment)"
|
@click="handleReplyClick"
|
||||||
>回复</span>
|
>回复</span>
|
||||||
|
|
||||||
<a-popconfirm
|
<a-popconfirm
|
||||||
v-else-if="comment.status === 'RECYCLE'"
|
v-else-if="comment.status === 'RECYCLE'"
|
||||||
:title="'你确定要还原该评论?'"
|
:title="'你确定要还原该评论?'"
|
||||||
@confirm="handleEditStatusClick(comment,'PUBLISHED')"
|
@confirm="handleEditStatusClick('PUBLISHED')"
|
||||||
okText="确定"
|
okText="确定"
|
||||||
cancelText="取消"
|
cancelText="取消"
|
||||||
>
|
>
|
||||||
|
@ -38,7 +38,7 @@
|
||||||
<a-popconfirm
|
<a-popconfirm
|
||||||
v-if="comment.status === 'PUBLISHED' || comment.status === 'AUDITING'"
|
v-if="comment.status === 'PUBLISHED' || comment.status === 'AUDITING'"
|
||||||
:title="'你确定要将该评论移到回收站?'"
|
:title="'你确定要将该评论移到回收站?'"
|
||||||
@confirm="handleEditStatusClick(comment,'RECYCLE')"
|
@confirm="handleEditStatusClick('RECYCLE')"
|
||||||
okText="确定"
|
okText="确定"
|
||||||
cancelText="取消"
|
cancelText="取消"
|
||||||
>
|
>
|
||||||
|
@ -47,7 +47,7 @@
|
||||||
|
|
||||||
<a-popconfirm
|
<a-popconfirm
|
||||||
:title="'你确定要永久删除该评论?'"
|
:title="'你确定要永久删除该评论?'"
|
||||||
@confirm="handleDeleteClick(comment)"
|
@confirm="handleDeleteClick"
|
||||||
okText="确定"
|
okText="确定"
|
||||||
cancelText="取消"
|
cancelText="取消"
|
||||||
>
|
>
|
||||||
|
@ -86,8 +86,8 @@
|
||||||
v-for="(child, index) in comment.children"
|
v-for="(child, index) in comment.children"
|
||||||
:key="index"
|
:key="index"
|
||||||
:comment="child"
|
:comment="child"
|
||||||
@reply="handleReplyClick(child)"
|
@reply="handleReplyClick"
|
||||||
@delete="handleDeleteClick(child)"
|
@delete="handleDeleteClick"
|
||||||
@editStatus="handleEditStatusClick"
|
@editStatus="handleEditStatusClick"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
|
@ -110,18 +110,19 @@ export default {
|
||||||
return `//cn.gravatar.com/avatar/${this.comment.gravatarMd5}/?s=256&d=mp`
|
return `//cn.gravatar.com/avatar/${this.comment.gravatarMd5}/?s=256&d=mp`
|
||||||
},
|
},
|
||||||
content() {
|
content() {
|
||||||
return marked(this.comment.content, { sanitize: true })
|
return marked(this.comment.content)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
handleReplyClick(comment) {
|
handleReplyClick() {
|
||||||
this.$emit('reply', comment)
|
console.log(this.comment)
|
||||||
|
this.$emit('reply', this.comment)
|
||||||
},
|
},
|
||||||
handleEditStatusClick(comment, status) {
|
handleEditStatusClick(status) {
|
||||||
this.$emit('editStatus', comment, status)
|
this.$emit('editStatus', this.comment, status)
|
||||||
},
|
},
|
||||||
handleDeleteClick(comment) {
|
handleDeleteClick() {
|
||||||
this.$emit('delete', comment)
|
this.$emit('delete', this.comment)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -98,7 +98,7 @@ export default {
|
||||||
computed: {
|
computed: {
|
||||||
formmatedCommentData() {
|
formmatedCommentData() {
|
||||||
return this.comments.map(comment => {
|
return this.comments.map(comment => {
|
||||||
comment.content = marked(comment.content, { sanitize: true })
|
comment.content = marked(comment.content)
|
||||||
return comment
|
return comment
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue