From 0b4249c52bc17a8bfeda9ea129a718103a96b8f4 Mon Sep 17 00:00:00 2001 From: reco_luan Date: Sat, 18 Apr 2020 19:43:49 +0800 Subject: [PATCH] style(vuepress-theme-reco): move comments code to page.vue --- .../vuepress-theme-reco/components/Common.vue | 40 +------------------ .../vuepress-theme-reco/components/Page.vue | 15 +++++++ .../vuepress-theme-reco/layouts/Category.vue | 2 +- packages/vuepress-theme-reco/layouts/Tag.vue | 2 +- packages/vuepress-theme-reco/layouts/Tags.vue | 2 +- .../vuepress-theme-reco/layouts/TimeLines.vue | 2 +- 6 files changed, 20 insertions(+), 43 deletions(-) diff --git a/packages/vuepress-theme-reco/components/Common.vue b/packages/vuepress-theme-reco/components/Common.vue index 027bf4b..bfcd929 100644 --- a/packages/vuepress-theme-reco/components/Common.vue +++ b/packages/vuepress-theme-reco/components/Common.vue @@ -34,11 +34,6 @@
- -
- -
-
@@ -69,9 +64,6 @@
-
- -
@@ -85,22 +77,17 @@ import Sidebar from '@theme/components/Sidebar' import { resolveSidebarItems } from '@theme/helpers/utils' import Password from '@theme/components/Password' import { setTimeout } from 'timers' -import ModuleTransition from '@theme/components/ModuleTransition' import moduleTransitonMixin from '@theme/mixins/moduleTransiton' export default { mixins: [moduleTransitonMixin], - components: { Sidebar, Navbar, Password, ModuleTransition }, + components: { Sidebar, Navbar, Password }, props: { sidebar: { type: Boolean, default: true - }, - isComment: { - type: Boolean, - default: true } }, @@ -117,15 +104,6 @@ export default { absoluteEncryption () { return this.$themeConfig.keyPage && this.$themeConfig.keyPage.absoluteEncryption === true }, - // 是否显示评论 - shouldShowComments () { - const { isShowComments, home } = this.$frontmatter - return !( - this.isComment == false || - isShowComments == false || - home == true - ) - }, shouldShowNavbar () { const { themeConfig } = this.$site @@ -280,23 +258,7 @@ export default { .hide height 100vh overflow hidden -.theme-container.no-sidebar - .comments-wrapper - padding-left 2rem -.comments-wrapper - padding 2rem 2rem 2rem 22rem - max-width: 740px; - margin: 0 auto; -@media (max-width: $MQNarrow) - .theme-container.no-sidebar - .comments-wrapper - padding-left 2rem - .comments-wrapper - padding-left: 18.4rem; -@media (max-width: $MQMobile) - .comments-wrapper - padding-left: 2rem .fade-enter-active, .fade-leave-active { transition: opacity .5s; } diff --git a/packages/vuepress-theme-reco/components/Page.vue b/packages/vuepress-theme-reco/components/Page.vue index 1bc09ef..e5e72d1 100644 --- a/packages/vuepress-theme-reco/components/Page.vue +++ b/packages/vuepress-theme-reco/components/Page.vue @@ -68,6 +68,10 @@

+ + + + @@ -90,6 +94,15 @@ export default { }, computed: { + // 是否显示评论 + shouldShowComments () { + const { isShowComments, home } = this.$frontmatter + return !( + this.isComment == false || + isShowComments == false || + home == true + ) + }, showAccessNumber () { return this.$themeConfig.commentsSolution === 'valine' }, @@ -242,6 +255,8 @@ function flatten (items, res) { .time font-weight 400 color #aaa + .comments-wrapper + @extend $wrapper .page-nav @extend $wrapper diff --git a/packages/vuepress-theme-reco/layouts/Category.vue b/packages/vuepress-theme-reco/layouts/Category.vue index d65b167..71fb815 100644 --- a/packages/vuepress-theme-reco/layouts/Category.vue +++ b/packages/vuepress-theme-reco/layouts/Category.vue @@ -1,5 +1,5 @@