menuList background data return format
{
// 统计分析
path: '/statistics',
name: 'Statistics',
meta:{title: '数据统计'},
component: 'views/statistics/Statistics'
}
component in routing
What is received is that @/views/statistics/Statistics
the page can be displayed normally.
If the parameters are dynamic, the following three types will report errors and the page will be blank.
let cop = `@/${item.component}`
// item.component = () => import(cop)
// item.component = resolve => require([cop], resolve)
// item.component = Promise.resolve().then(() => require(`@/${item.component}`))
Is there any good way to solve this problem?
name is the component page address
item.component = (name) => () => import(`@/${name}.vue`)