新增页面,动态添加路由不成功,

accessedTreeRoutes.push({
            path: element.url,
            component: Layout,
            children: [
              {
                path: 'index',
                component: () => import(`@/views${element.component}/index`),
                name: element.name,
                meta: { title: element.name, icon: element.icon, noCache: true }
              }
            ]
          })
 
          router.addRoutes(accessRoutes)
 
编译会不成功
.eslintrc.js
要改
'indent': "off",
    // 'indent': [2, 2, {
    //   'SwitchCase': 1
    // }],
    //'template-curly-spacing':  [2, 'never'],
动态加载路由搞定。

相关文章:

  • 2021-07-02
  • 2022-12-23
  • 2022-12-23
  • 2021-12-28
  • 2021-12-22
猜你喜欢
  • 2021-10-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案