- 写vue时候,通常会进行路由懒加载,如下:
{path: '/settlementCenter/offCompensationSettlement',name: 'XXX',component: () =>import('@/view/settlementCenter/settlement/offCompensationSettlement.vue'),meta: {}},
- 写vue代码页面时,可以使用按需加载组件
大多数情况下,vue页面可能是如下的写法:访问该页面/组件时,就立刻加载business.vue
import Business from '@/view/home/business.vue'
export default {components: {Business}
}
也可以使用这种按需加载方式来优化性能:Business激活时才会进行加载
export default {components: {'Business': () => import('@/view/home/business.vue')}
}