动态添加了路由然后就报错了,添加动态路由的代码如下,data是后台获取的数据,自己写了个404页面,path: '/404'也没有这个错误。data.permission = [{
path: '/index',
name: 'index',
component: './../views/layout/index'}]this.$router.addRoutes(data.permission)然后就报下面的错误,求解Uncaught (in promise) Error: [vue-router] route config "component" for path: /index cannot be a
string id. Use an actual component instead.
1 回答

犯罪嫌疑人X
TA贡献2080条经验 获得超4个赞
component字段加个require,错误信息理解错了
component:require('./../views/layout/index.vue')
添加回答
举报
0/150
提交
取消