带你快速理解路由懒加载

2020-04-19  本文已影响0人  上海老宅男
const getMobile = name => () =>
  import (`../mobile/${name}.vue`)

这个方法是放在router/index.js里面
当我们再次去写路由的时候就可以直接写mobile下的文件

{path: '/Tabbar', name: 'Tabbar', component: getMobile('tabbar/Tabbar')},
上一篇 下一篇

猜你喜欢

热点阅读