Vue中的懒加载

1.路由懒加载

export default new Router({
    router:[
        path:'/myproject',
        name:'myproject',
        //懒加载 resolve=>require([URL],resolve)
        compontent:resolve=>require(['../page/myproject/myproject.vue'],resolve)
    ]
})

2.组件懒加载

compontent:{
    historyTab:resolve=>{
    require(['../../compontent/historyTab/historyTab.vue'],resolve)
    }
}

3.全局懒加载

Vue.compontent('home',()=>{
    System.import('./compontent/home/home.vue')
})

 

你可能感兴趣的:(Vue)