Skip to content

JeremieLitzler/vueschool-course

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

67 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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: