文章詳情頁
vue 動(dòng)態(tài)路由component 傳遞變量報(bào)錯(cuò)問題解決
瀏覽:84日期:2022-06-10 08:11:45
目錄
- menuList 后臺(tái)數(shù)據(jù)返回格式
- 路由里面component
menuList 后臺(tái)數(shù)據(jù)返回格式
{ // 統(tǒng)計(jì)分析 path: "/statistics", name: "Statistics", meta:{title: "數(shù)據(jù)統(tǒng)計(jì)"}, component: "views/statistics/Statistics"}
路由里面component
接收的是 @/views/statistics/Statistics
能正常顯示頁面
如果動(dòng)態(tài)參數(shù),以下三種都會(huì)報(bào)錯(cuò),頁面空白
let cop = `@/${item.component}`// item.component = () => import(cop)// item.component = resolve => require([cop], resolve)// item.component = Promise.resolve().then(() => require(`@/${item.component}`))
請(qǐng)問有沒有好的辦法解決這個(gè)問題?
name為組件頁面地址
item.component = (name) => () => import(`@/${name}.vue`)
以上就是vue 動(dòng)態(tài)路由component 傳遞變量報(bào)錯(cuò)問題解決的詳細(xì)內(nèi)容,更多關(guān)于vue 動(dòng)態(tài)路由傳遞變量報(bào)錯(cuò)的資料請(qǐng)關(guān)注其它相關(guān)文章!
標(biāo)簽:
JavaScript
排行榜
