vue路由懒加载写法

1.我最常用的写法是:

{
   path: '/home',
   component: resolve => require(['../components/home.vue'], resolve),
 }

2.cue-cli 3.0 建的项目给的示例写法是:

{
   path: '/about',
   name: 'about',
   // route level code-splitting
   // this generates a separate chunk (about.[hash].js) for this route
   // which is lazy-loaded when the route is visited.
   component: () => import(/* webpackChunkName: "about" */ './views/About.vue')
 }

你可能感兴趣的:(随手记)