多个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

解决办法

一定要把componentsJS当作文件夹,上述代码是引用路径错误,在导航地址后面一定要添加/,正确的代码为:

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']
          ]
        }
      ]
   }
Logo

前往低代码交流专区

更多推荐