Skip to content

Latest commit

 

History

History
47 lines (27 loc) · 1.07 KB

README.md

File metadata and controls

47 lines (27 loc) · 1.07 KB

Projects and notes with VueSchool courses

Notes

Routing

How to lazy load routes with Vue Router

It is is done with Webpack.

It can be done for the routes or within components having sub-components.

For a route, it looks like this:

  {
    path: '/a-route',
    name: 'a-route',
    component: () =>
      import(/* webpackChunkName: "a-route" */ '../views/PageSomething.vue'),
  },

Webpack will generate a a-route.js file that is loaded only when the route is browsed to.

For a component, we use the same techique the parent component: