路由懒加载

为什么要做路由懒加载?

当打包构建应用的时候javas包变得很大,影响页面加载速度。所以把不同路由对应的组件分割成不同的代码块,当路由访问到的时候才加载对应的组件,提升效率。

怎么做?

const routes =[

{

path:'/home',

component:()=>important('../comportants/Home')

},

{

component:()=>important('../comportants/About')

}

];

是什么?

原文地址:https://www.cnblogs.com/jscai/p/12568359.html