vue lazy load component 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 image loading vue
$ npm i vue-lazyload -S
Example 3: 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'),
},
],
Example 4: lazy loading by scroll vue
npm i vue-infinite-loading