原因:
因为import 在webpack4中动态路由中不能包含变量
出错写法:
export const loadView = (view) => { // 路由懒加载
//return (resolve) => require([`@/views/${view}`],resolve)
return () => import(`@/views/${view}`)
}
正确写法:
export const loadView = (view) => { // 路由懒加载
return (resolve) => require([`@/views/${view}`],resolve)
// return () => import(`@/views/${view}`)
}