vue router lazy load code example
Example 1: vue js lazy load component
const Foo = () => import('./Foo.vue')
const router = new VueRouter({
routes: [{ path: '/foo', component: Foo }]
})
Example 2: Lazy Loading Routes vue
routes: [
{
path: '/vue_films-app',
name: 'Movies',
component: Movies,
},
{
path: '/vue_films-app/details/:id',
name: 'Details',
component: () => import('../views/Details.vue'),
},
],