目录
  • menuList 后台数据返回格式
    • 路由里面component

menuList 后台数据返回格式

{
    // 统计分析
    path: '/statistics',
    name: 'Statistics',
    meta:{title: '数据统计'},
    component: 'views/statistics/Statistics'
}

路由里面component

接收的是 @/views/statistics/Statistics 能正常显示页面

vue 动态路由component 传递变量报错问题解决

vue 动态路由component 传递变量报错问题解决

如果动态参数,以下三种都会报错,页面空白

let cop = `@/${item.component}`
// item.component = () => import(cop)
// item.component = resolve => require([cop], resolve)
// item.component = Promise.resolve().then(() => require(`@/${item.component}`))

vue 动态路由component 传递变量报错问题解决

请问有没有好的办法解决这个问题?

name为组件页面地址

item.component = (name) => () => import(`@/${name}.vue`)

以上就是vue 动态路由component 传递变量报错问题解决的详细内容,更多关于vue 动态路由传递变量报错的资料请关注其它相关文章!

声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。