路由懒加载

为什么要做路由懒加载?

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

怎么做?

const routes =[

{

path:'/home',

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

},

{

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

}

];

是什么?

 

posted @ 2020-03-25 18:13  笑看吴钩  阅读(163)  评论(0编辑  收藏  举报