Skip to content

Commit

Permalink
fix(vuepress-theme-reco): fix content display error
Browse files Browse the repository at this point in the history
  • Loading branch information
reco_luan committed Feb 12, 2021
1 parent 26006fe commit 1da9000
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 21 deletions.
21 changes: 8 additions & 13 deletions packages/vuepress-theme-reco/components/Page.vue
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
<template>
<main class="page" :style="pageStyle">
<ModuleTransition>
<div v-if="recoShowModule && $page.title" class="page-title">
<h1 class="title">{{$page.title}}</h1>
<PageInfo :pageInfo="$page" :showAccessNumber="showAccessNumber"></PageInfo>
</div>
</ModuleTransition>

<ModuleTransition delay="0.08">
<!-- 这里使用 v-show,否则影响 SSR -->
<Content v-show="recoShowModule" class="theme-reco-content" />
<section v-show="recoShowModule">
<div class="page-title">
<h1 class="title">{{$page.title}}</h1>
<PageInfo :pageInfo="$page" :showAccessNumber="showAccessNumber"></PageInfo>
</div>
<!-- 这里使用 v-show,否则影响 SSR -->
<Content class="theme-reco-content" />
</section>
</ModuleTransition>

<ModuleTransition delay="0.16">
Expand Down Expand Up @@ -53,10 +52,6 @@
<ModuleTransition delay="0.32">
<Comments v-if="recoShowModule" :isShowComments="shouldShowComments"/>
</ModuleTransition>

<ModuleTransition delay="0.08">
<SubSidebar v-if="recoShowModule" class="side-bar" />
</ModuleTransition>
</main>
</template>

Expand Down
18 changes: 11 additions & 7 deletions packages/vuepress-theme-reco/layouts/Layout.vue
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,20 @@ export default defineComponent({
const instance = getCurrentInstance()
const sidebarItems = computed(() => {
return resolveSidebarItems(
instance.$page,
instance.$page.regularPath,
instance.$site,
instance.$localePath
)
if (instance.$page) {
return resolveSidebarItems(
instance.$page,
instance.$page.regularPath,
instance.$site,
instance.$localePath
)
} else {
return []
}
})
const homeCom = computed(() => {
const { type } = instance.$themeConfig
const { type } = instance.$themeConfig || {}
if (type !== undefined) {
return type == 'blog' ? 'HomeBlog' : type
}
Expand Down

0 comments on commit 1da9000

Please sign in to comment.