File tree Expand file tree Collapse file tree 9 files changed +35
-17
lines changed Expand file tree Collapse file tree 9 files changed +35
-17
lines changed Original file line number Diff line number Diff line change 1818 :post-title =" post.title"
1919 :current-path =" currentPath"
2020 :plugin-configs =" pluginConfigs"
21+ :comments =" enabledComment"
2122 ref =" postStatsRef"
2223 />
2324 </div >
6465 <div class =" col-span-1" >
6566 <Sidebar >
6667 <Profile author =" blog-author" />
67- <Toc :toc =" post.toc" />
68+ <Toc :toc =" post.toc" :comments = " enabledComment " />
6869 </Sidebar >
6970 </div >
7071 </div >
@@ -90,6 +91,7 @@ import { useCommonStore } from '@/stores/common'
9091import { useRoute } from ' vue-router'
9192import PostStats from ' ./Post/PostStats.vue'
9293import { useAppStore } from ' @/stores/app'
94+ import useCommentPlugin from ' @/hooks/useCommentPlugin'
9395
9496interface PostStatsExpose extends Ref <InstanceType <typeof PostStats >> {
9597 getCommentCount(): void
@@ -119,6 +121,7 @@ export default defineComponent({
119121 const post = toRefs (props ).post
120122 const title = toRefs (props ).title
121123 const postStatsRef = ref <PostStatsExpose >()
124+ const { enabledCommentPlugin } = useCommentPlugin ()
122125
123126 watch (
124127 () => post .value .covers ,
@@ -147,6 +150,9 @@ export default defineComponent({
147150 })
148151
149152 return {
153+ enabledComment: computed (
154+ () => post .value .comments && enabledCommentPlugin .value .plugin !== ' '
155+ ),
150156 pageTitle: computed (() => {
151157 if (title .value !== ' ' ) return title .value
152158 return post .value .title
Original file line number Diff line number Diff line change 4444 </span >
4545 </span >
4646 </span >
47- <span v-if =" plugin === 'waline'" >
47+ <span v-if =" comments && plugin === 'waline'" >
4848 <SvgIcon
4949 class =" h-5 w-5"
5050 icon-class =" quote"
7474 <ob-skeleton width =" 40px" height =" 16px" />
7575 </span >
7676 </span >
77- <span v-if =" plugin === 'twikoo'" >
77+ <span v-if =" comments && plugin === 'twikoo'" >
7878 <SvgIcon
7979 class =" h-5 w-5"
8080 icon-class =" quote"
157157 <ob-skeleton width =" 40px" height =" 16px" />
158158 </span >
159159 </span >
160- <span v-if =" plugin === 'waline' || plugin === 'twikoo'" >
160+ <span v-if =" comments && ( plugin === 'waline' || plugin === 'twikoo') " >
161161 <SvgIcon
162162 icon-class =" quote"
163163 fill =" none"
@@ -200,7 +200,8 @@ export default defineComponent({
200200 type: String ,
201201 default: ' /' ,
202202 required: true
203- }
203+ },
204+ comments: Boolean
204205 },
205206 setup(props , { expose }) {
206207 const commentCount = ref <number | undefined >(undefined )
Original file line number Diff line number Diff line change 1616 <SvgIcon class =" inline-block text-3xl" icon-class =" back-to-top" />
1717 </li >
1818 <li
19- v-if =" enabledPlugin "
19+ v-if =" comments "
2020 class =" flex justify-center py-3 w-full hover:opacity-50 hover:text-ob transition-all cursor-pointer"
2121 @click =" jumpToComments"
2222 data-dia =" jump-to-comment"
@@ -36,10 +36,12 @@ import useCommentPlugin from '@/hooks/useCommentPlugin'
3636export default defineComponent ({
3737 name: ' Navigator' ,
3838 components: { SvgIcon },
39+ props: {
40+ comments: Boolean
41+ },
3942 setup() {
4043 const router = useRouter ()
4144 const { jumpToEle } = useJumpToEle ()
42- const { enabledCommentPlugin } = useCommentPlugin ()
4345
4446 const backToTop = () => {
4547 window .scrollTo ({
@@ -57,7 +59,6 @@ export default defineComponent({
5759 }
5860
5961 return {
60- enabledPlugin: computed (() => enabledCommentPlugin .value .plugin !== ' ' ),
6162 goBack ,
6263 backToTop ,
6364 jumpToComments
Original file line number Diff line number Diff line change 1212 />
1313 </div >
1414 </transition >
15- <Navigator />
15+ <Navigator :comments = " comments " />
1616 </div >
1717 </Sticky >
1818</template >
@@ -27,7 +27,8 @@ export default defineComponent({
2727 name: ' ObTOC' ,
2828 components: { SubTitle , Sticky , Navigator },
2929 props: {
30- toc: String
30+ toc: String ,
31+ comments: Boolean
3132 },
3233 setup(props ) {
3334 const tocData = toRefs (props ).toc
Original file line number Diff line number Diff line change @@ -59,7 +59,7 @@ export class Page<DataType = Link[] | Record<string, Link[]>>
5959 year : 0
6060 }
6161 updated = ''
62- comments = false
62+ comments = true
6363 path = ''
6464 covers : string | null = null
6565 excerpt : string | null = null
Original file line number Diff line number Diff line change @@ -51,7 +51,7 @@ export class Post {
5151 year : 0
5252 }
5353 updated = ''
54- comments = false
54+ comments = true
5555 path = ''
5656 excerpt : string | null = null
5757 keywords : string | null = null
Original file line number Diff line number Diff line change 2020 :post-title =" pageData.title"
2121 :current-path =" currentPath"
2222 :plugin-configs =" pluginConfigs"
23+ :comments =" enabledComment"
2324 ref =" postStatsRef"
2425 />
2526 </div >
@@ -117,7 +118,6 @@ import LinkCategoryList from '@/components/Link/LinkCategoryList.vue'
117118import LinkList from ' @/components/Link/LinkList.vue'
118119import Comment from ' @/components/Comment.vue'
119120import Breadcrumbs from ' @/components/Breadcrumbs.vue'
120- import { useMetaStore } from ' @/stores/meta'
121121import usePageTitle from ' @/hooks/usePageTitle'
122122import useJumpToEle from ' @/hooks/useJumpToEle'
123123import useCommentPlugin from ' @/hooks/useCommentPlugin'
@@ -173,7 +173,10 @@ export default defineComponent({
173173 gradientBackground: computed (() => {
174174 return { background: appStore .themeConfig .theme .header_gradient_css }
175175 }),
176- enabledComment: computed (() => enabledCommentPlugin .value .plugin !== ' ' ),
176+ enabledComment: computed (
177+ () =>
178+ pageData .value .comments && enabledCommentPlugin .value .plugin !== ' '
179+ ),
177180 pageTitle ,
178181 jumpToContent ,
179182 postStatsRef ,
Original file line number Diff line number Diff line change @@ -83,7 +83,10 @@ export default defineComponent({
8383 onBeforeMount (fetchArticle )
8484
8585 return {
86- enabledComment: computed (() => enabledCommentPlugin .value .plugin !== ' ' ),
86+ enabledComment: computed (
87+ () =>
88+ pageData .value .comments && enabledCommentPlugin .value .plugin !== ' '
89+ ),
8790 pageTitle: computed (() => pageTitle .value ),
8891 pageData ,
8992 t
Original file line number Diff line number Diff line change 9191 :post-title =" post.title"
9292 :current-path =" currentPath"
9393 :plugin-configs =" pluginConfigs"
94+ :comments =" enabledComment"
9495 ref =" postStatsRef"
9596 />
9697 </div >
166167 <div >
167168 <Sidebar >
168169 <Profile :author =" post.author.slug || ''" />
169- <Toc :toc =" post.toc" />
170+ <Toc :toc =" post.toc" :comments = " enabledComment " />
170171 </Sidebar >
171172 </div >
172173 </div >
@@ -268,7 +269,9 @@ export default defineComponent({
268269 isMobile: computed (() => commonStore .isMobile ),
269270 currentPath: computed (() => route .path ),
270271 pluginConfigs: computed (() => appStore .themeConfig .plugins ),
271- enabledComment: computed (() => enabledCommentPlugin .value .plugin !== ' ' ),
272+ enabledComment: computed (
273+ () => post .value .comments && enabledCommentPlugin .value .plugin !== ' '
274+ ),
272275 postStatsRef ,
273276 SvgTypes ,
274277 commonStore ,
You can’t perform that action at this time.
0 commit comments