Vue routing lazy loading (two ways of writing)

Lazy loading is also called lazy loading, that is, it is loaded when it is needed and loaded as needed. In a single-page application, if there is no application lazy loading, the files packaged with webpack will be abnormally large, causing too much content to be loaded when entering the homepage, and the delay is too long, which is not conducive to the user experience, and lazy loading is used Then you can divide the page and load the page when needed, which can effectively share the loading pressure of the home page and reduce the time it takes to load the home page.

 routes: [
    {
    
    
      path: '/',
      name: 'HelloWorld',
      component: () => import('@/page/Vuex/index')  
    }
  ]

or
Insert picture description here

Guess you like

Origin blog.csdn.net/qq_44977477/article/details/108524378
Recommended