VuePress生成多个侧边栏
1. 简单的多个侧边栏 vuepress介绍 相当于所有的导航栏公用一个侧边栏

- 需要在
.vuepress目录下的config.js文件中配置

config.js文件 目前针对于默认的主题配置module.exports = { themeConfig: { nav: [ { text: '指南', link: '/guide/' }, { text: 'VuePress配置', link: '/vuepress-config/' }, ], sidebar: [ { title: '基础', path: '/guide/', sidebarDepth: 2, children: [ { title: '设置', path: '/' } ] } ] } }
2. 每个导航栏指定独立的侧边栏

- 变动的只是
config.js中的配置module.exports = { themeConfig: { nav: [ { text: '指南', link: '/guide/' }, { text: 'VuePress配置', link: '/vuepress-config/' }, ], sidebar: { '/guide/': [ { title: '基础', path: '/guide/' } ], '/vuepress-config/': [ { title: 'VuePress配置', sidebarDepth: 2, children: [ { title: '介绍', path: '/vuepress-config/' } ] } ] } } }
3. 文件的目录结构
- 需要展示导航栏的数据需要和
.vuepress同级,README.md文件也可以省略,类似于index.vue也可以在导入的时候被省略


本文详细介绍了如何在VuePress中配置多个独立的侧边栏,包括为不同导航栏指定特定的侧边栏,以及如何通过修改config.js文件实现这一功能。


被折叠的 条评论
为什么被折叠?



