非懒加载
const router = new VueRouter({
routes: [{
path: '/list',
component: @/components/list.vue
}
]
})
方案一
const List = () => import('@/components/list.vue')
const router = new VueRouter({
routes: [{
path: '/list',
component: List
}
]
})
方案2
const router = new Router({
routes: [
{
path: '/list',
component: (resolve) => {
require(['@/components/list'], resolve)
}
}
]
})