非懒加载: import List from '@/components/list.vue' const router = new VueRouter({ routes: [ { path: '/list', component: List } ] }) 懒加载:
1.使用箭头函数+import动态加载
const List = () => import('@/components/list.vue') const router = new VueRouter({ routes: [ { path: '/list', component: List } ] })
2.使用箭头函数+require动态加载
const router = new Router({ routes: [ { path: '/list', component: resolve => require(['@/components/list'], resolve) } ] })
标签:Vue,const,List,list,new,path,Router,加载 From: https://www.cnblogs.com/huwenlong/p/17643984.html