路由懒加载可以帮我们在进入首屏时不用加载过度的资源,从而减少首屏加载速度。
(1)路由文件中,非懒加载写法:
import Index from '@/page/index/index';
export default new Router({
routes: [
{
path: '/',
name: 'Index',
component: Index
}
]
})
(2)路由懒加载写法:
export default new Router({
routes: [
{
path: '/',
name: 'Index',
component: resolve => require(['@/view/index/index'], resolve)
}
]
})
标签:Index,vue,..,index,首屏,写法,路由,加载
From: https://www.cnblogs.com/mahmud/p/16756955.html