1.懒加载第一种情况
- 有时候需要使用多个子组件的时候我们就可以使用子组件懒加载
- 定义好所需要的子组件,在components中实现按需加载,也就是懒加载
const coms = {
compSteps: resolve => {
require(['@/pages/components/xxxx.vue'], resolve)
},
pInfo: resolve => {
require(['@/pages/components/xxxx.vue'], resolve)
},
pForm: resolve => {
require(['@/pages/components/xxx.vue'], resolve)
},
bisDialog: resolve => {
require(['@/pages/components/xxx.vue'], resolve)
},
}
export default {
components:coms
}
2.懒加载第二种情况
- 也可以直接在conponents里面直接实现懒加载
expore default {
components:{
childrenComp:require(['@/pages/components/xxxx.vue'], resolve)
}
}