style(vuepress-theme-reco): move comments code to page.vue

This commit is contained in:
reco_luan 2020-04-18 19:43:49 +08:00
parent dd43e736aa
commit 0b4249c52b
6 changed files with 20 additions and 43 deletions

View File

@ -34,11 +34,6 @@
<Password v-show="!isHasPageKey" :isPage="true" class="password-wrapper-in" key="in"></Password> <Password v-show="!isHasPageKey" :isPage="true" class="password-wrapper-in" key="in"></Password>
<div :class="{ 'hide': !isHasPageKey }"> <div :class="{ 'hide': !isHasPageKey }">
<slot></slot> <slot></slot>
<ModuleTransition delay=".48">
<div v-show="recoShowModule">
<Comments :isShowComments="shouldShowComments"/>
</div>
</ModuleTransition>
</div> </div>
</div> </div>
</div> </div>
@ -69,9 +64,6 @@
<Password v-if="!isHasPageKey" :isPage="true"></Password> <Password v-if="!isHasPageKey" :isPage="true"></Password>
<div v-else> <div v-else>
<slot></slot> <slot></slot>
<div v-show="recoShowModule">
<Comments :isShowComments="shouldShowComments"/>
</div>
</div> </div>
</div> </div>
</transition> </transition>
@ -85,22 +77,17 @@ import Sidebar from '@theme/components/Sidebar'
import { resolveSidebarItems } from '@theme/helpers/utils' import { resolveSidebarItems } from '@theme/helpers/utils'
import Password from '@theme/components/Password' import Password from '@theme/components/Password'
import { setTimeout } from 'timers' import { setTimeout } from 'timers'
import ModuleTransition from '@theme/components/ModuleTransition'
import moduleTransitonMixin from '@theme/mixins/moduleTransiton' import moduleTransitonMixin from '@theme/mixins/moduleTransiton'
export default { export default {
mixins: [moduleTransitonMixin], mixins: [moduleTransitonMixin],
components: { Sidebar, Navbar, Password, ModuleTransition }, components: { Sidebar, Navbar, Password },
props: { props: {
sidebar: { sidebar: {
type: Boolean, type: Boolean,
default: true default: true
},
isComment: {
type: Boolean,
default: true
} }
}, },
@ -117,15 +104,6 @@ export default {
absoluteEncryption () { absoluteEncryption () {
return this.$themeConfig.keyPage && this.$themeConfig.keyPage.absoluteEncryption === true return this.$themeConfig.keyPage && this.$themeConfig.keyPage.absoluteEncryption === true
}, },
//
shouldShowComments () {
const { isShowComments, home } = this.$frontmatter
return !(
this.isComment == false ||
isShowComments == false ||
home == true
)
},
shouldShowNavbar () { shouldShowNavbar () {
const { themeConfig } = this.$site const { themeConfig } = this.$site
@ -280,23 +258,7 @@ export default {
.hide .hide
height 100vh height 100vh
overflow hidden 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 { .fade-enter-active, .fade-leave-active {
transition: opacity .5s; transition: opacity .5s;
} }

View File

@ -68,6 +68,10 @@
</p> </p>
</div> </div>
</ModuleTransition> </ModuleTransition>
<ModuleTransition delay="0.24">
<Comments v-if="recoShowModule" :isShowComments="shouldShowComments"/>
</ModuleTransition>
</main> </main>
</template> </template>
@ -90,6 +94,15 @@ export default {
}, },
computed: { computed: {
//
shouldShowComments () {
const { isShowComments, home } = this.$frontmatter
return !(
this.isComment == false ||
isShowComments == false ||
home == true
)
},
showAccessNumber () { showAccessNumber () {
return this.$themeConfig.commentsSolution === 'valine' return this.$themeConfig.commentsSolution === 'valine'
}, },
@ -242,6 +255,8 @@ function flatten (items, res) {
.time .time
font-weight 400 font-weight 400
color #aaa color #aaa
.comments-wrapper
@extend $wrapper
.page-nav .page-nav
@extend $wrapper @extend $wrapper

View File

@ -1,5 +1,5 @@
<template> <template>
<Common class="categories-wrapper" :sidebar="false" :isComment="false"> <Common class="categories-wrapper" :sidebar="false">
<!-- 分类集合 --> <!-- 分类集合 -->
<ModuleTransition> <ModuleTransition>
<ul v-show="recoShowModule" class="category-wrapper"> <ul v-show="recoShowModule" class="category-wrapper">

View File

@ -1,6 +1,6 @@
<template> <template>
<!-- 公共布局 --> <!-- 公共布局 -->
<Common class="tag-wrapper" :sidebar="false" :isComment="false"> <Common class="tag-wrapper" :sidebar="false">
<!-- 标签集合 --> <!-- 标签集合 -->
<ModuleTransition> <ModuleTransition>
<TagList <TagList

View File

@ -1,5 +1,5 @@
<template> <template>
<Common class="tags-wrapper" :sidebar="false" :isComment="false"> <Common class="tags-wrapper" :sidebar="false">
<!-- 标签集合 --> <!-- 标签集合 -->
<ModuleTransition> <ModuleTransition>
<TagList <TagList

View File

@ -1,5 +1,5 @@
<template> <template>
<Common class="timeline-wrapper" :sidebar="false" :isComment="false"> <Common class="timeline-wrapper" :sidebar="false">
<ul class="timeline-content"> <ul class="timeline-content">
<ModuleTransition > <ModuleTransition >
<li v-show="recoShowModule" class="desc">Yesterday Once More!</li> <li v-show="recoShowModule" class="desc">Yesterday Once More!</li>