编程日志 Vue-element-admin

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

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'],
动态加载路由搞定。

猜你喜欢

转载自www.cnblogs.com/forhell/p/12331760.html
今日推荐