Skip to content

Commit bbdca20

Browse files
author
reco_luan
committed
feat: fix comments
Add front-matter information processing about comments.
1 parent a2949dc commit bbdca20

File tree

2 files changed

+17
-3
lines changed

2 files changed

+17
-3
lines changed

components/Common.vue

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
<Password v-if="!isHasPageKey" :isPage="true"></Password>
3131
<div v-else>
3232
<slot></slot>
33-
<Comments :isShowComments="isComment"/>
33+
<Comments :isShowComments="isShow"/>
3434
</div>
3535
</div>
3636
</transition>
@@ -48,7 +48,16 @@ import { setTimeout } from 'timers'
4848
export default {
4949
components: { Sidebar, Navbar, Password },
5050
51-
props: ['sidebar', 'isComment'],
51+
props: {
52+
sidebar: {
53+
type: Boolean,
54+
default: false
55+
},
56+
isComment: {
57+
type: Boolean,
58+
default: true
59+
}
60+
},
5261
5362
data () {
5463
return {
@@ -60,6 +69,11 @@ export default {
6069
},
6170
6271
computed: {
72+
// 是否显示评论
73+
isShow () {
74+
const { isShowComments, home } = this.$frontmatter
75+
return !(this.isComment == false || isShowComments == false || home == true)
76+
},
6377
shouldShowNavbar () {
6478
const { themeConfig } = this.$site
6579
const { frontmatter } = this.$page

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
"@vuepress-reco/vuepress-plugin-pagation": "^1.0.3",
3232
"@vuepress-reco/vuepress-plugin-screenfull": "^1.0.0",
3333
"@vuepress-reco/vuepress-plugin-ga": "^1.0.2",
34-
"@vuepress-reco/vuepress-plugin-comments": "^1.0.4",
34+
"@vuepress-reco/vuepress-plugin-comments": "^1.0.5",
3535
"@vuepress/plugin-medium-zoom": "1.2.0",
3636
"@vuepress/plugin-blog": "1.3.0",
3737
"leancloud-storage": "3.13.2",

0 commit comments

Comments
 (0)