Skip to content

Commit 1da9000

Browse files
author
reco_luan
committed
fix(vuepress-theme-reco): fix content display error
1 parent 26006fe commit 1da9000

File tree

3 files changed

+20
-21
lines changed

3 files changed

+20
-21
lines changed

packages/vuepress-theme-reco/components/Page.vue

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
<template>
22
<main class="page" :style="pageStyle">
3-
<ModuleTransition>
4-
<div v-if="recoShowModule && $page.title" class="page-title">
5-
<h1 class="title">{{$page.title}}</h1>
6-
<PageInfo :pageInfo="$page" :showAccessNumber="showAccessNumber"></PageInfo>
7-
</div>
8-
</ModuleTransition>
9-
103
<ModuleTransition delay="0.08">
11-
<!-- 这里使用 v-show,否则影响 SSR -->
12-
<Content v-show="recoShowModule" class="theme-reco-content" />
4+
<section v-show="recoShowModule">
5+
<div class="page-title">
6+
<h1 class="title">{{$page.title}}</h1>
7+
<PageInfo :pageInfo="$page" :showAccessNumber="showAccessNumber"></PageInfo>
8+
</div>
9+
<!-- 这里使用 v-show,否则影响 SSR -->
10+
<Content class="theme-reco-content" />
11+
</section>
1312
</ModuleTransition>
1413

1514
<ModuleTransition delay="0.16">
@@ -53,10 +52,6 @@
5352
<ModuleTransition delay="0.32">
5453
<Comments v-if="recoShowModule" :isShowComments="shouldShowComments"/>
5554
</ModuleTransition>
56-
57-
<ModuleTransition delay="0.08">
58-
<SubSidebar v-if="recoShowModule" class="side-bar" />
59-
</ModuleTransition>
6055
</main>
6156
</template>
6257

packages/vuepress-theme-reco/layouts/Layout.vue

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,20 @@ export default defineComponent({
2323
const instance = getCurrentInstance()
2424
2525
const sidebarItems = computed(() => {
26-
return resolveSidebarItems(
27-
instance.$page,
28-
instance.$page.regularPath,
29-
instance.$site,
30-
instance.$localePath
31-
)
26+
if (instance.$page) {
27+
return resolveSidebarItems(
28+
instance.$page,
29+
instance.$page.regularPath,
30+
instance.$site,
31+
instance.$localePath
32+
)
33+
} else {
34+
return []
35+
}
3236
})
3337
3438
const homeCom = computed(() => {
35-
const { type } = instance.$themeConfig
39+
const { type } = instance.$themeConfig || {}
3640
if (type !== undefined) {
3741
return type == 'blog' ? 'HomeBlog' : type
3842
}

0 commit comments

Comments
 (0)