VuePress 自定义默认主题页眉页脚

方式

添加 2 个文件

.vuepress/theme/index.js
1
2
3
module.exports = {
extend: '@vuepress/theme-default'
}
.vuepress/theme/layouts/Layout.vue
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
<template>
<ParentLayout>
<template #sidebar-top>
<div>My custom sidebar-top</div>
</template>
<template #sidebar-bottom>
<div>My custom sidebar-bottom</div>
</template>
<template #page-top>
<div>My custom page-top</div>
</template>
<template #page-bottom>
<div>My custom page-bottom</div>
</template>
</ParentLayout>
</template>

<script>
import ParentLayout from '@parent-theme/layouts/Layout.vue'

export default {
name: 'Layout',
components: {
ParentLayout
}
}
</script>

效果

适用版本

vuepress v1.5.4

Global Footer in Default Theme #339

VuePress 自定义默认主题页眉页脚

https://www.imaegoo.com/2020/vuepress-default-theme-slot/

作者

iMaeGoo

发布于

2020-09-15

更新于

2020-09-15

许可协议

CC BY 4.0

评论