我有延迟加载嵌套路由的问题!
这是我的父路线:
import ChildRoutes from "app/modules/child.route”;
routes: [
{
path: '/child',
component: resolve => require(['app/modules/root'], resolve),
children: ChildRoutes
}
]
Run Code Online (Sandbox Code Playgroud)
而我的child.route.js
是
import ChildHome from …
import ChildContact from …
export default [
{
path: '',
name: 'childHome',
component: ChildHome
},
{
path: 'about',
name: 'childAbout',
// doesn’t work
component: resolve => require(['./components/about.vue'], resolve)
},
{
path: 'contact',
name: 'childContact',
// this one doesn’t work as well
component: ChildContact
},
...
]
Run Code Online (Sandbox Code Playgroud)
当然,第一个子路由 ( childHome
) 会自动工作,但之后我只会得到没有渲染组件的空白页面!如果我懒惰地加载父母和孩子,一切都会好起来的!
我究竟做错了什么?
值得一提的是我的项目使用 …