vuepress 配置多个sidebar,遇到的坑
多个sidebar配置themeConfig: {nav: [{ text: "主页", link: "/" },{ text: "组件", link: "/components" },{ text: '前端技术', link: '/JS' }],sidebar: {'/components': [...],'/JS': [{title
·
多个sidebar配置
themeConfig: {
nav: [
{ text: "主页", link: "/" },
{ text: "组件", link: "/components" },
{ text: '前端技术', link: '/JS' }
],
sidebar: {
'/components': [
...
],
'/JS': [
{
title: '前端技术',
sidebarDepth: 2,
collapsable: true,
children: [
['/JS/ES6','ES6'],
['/JS/Cesium','Cesium']
]
}
]
}
一直提示,components.html、JS.html为404
解决办法
一定要把components
、JS
当作文件夹,上述代码是引用路径错误,在导航地址后面一定要添加/
,正确的代码为:
themeConfig: {
nav: [
{ text: "主页", link: "/" },
{ text: "组件", link: "/components/" },
{ text: '前端技术', link: '/JS/' }
],
sidebar: {
'/components/': [
...
],
'/JS/': [
{
title: '前端技术',
sidebarDepth: 2,
collapsable: true,
children: [
['/JS/ES6','ES6'],
['/JS/Cesium','Cesium']
]
}
]
}
更多推荐
已为社区贡献5条内容
所有评论(0)