1.动态组件
点击toggle切换2个组件,配合<keep-alive>使用防止切换后数据丢失
<keep-alive><component :is="currentItem"></component>
</keep-alive>
2.异步组件
定义方法:app.component('组件名',Vue.defineAsyncComponent(()=>{
return new Promise((reslove,reject)=>{})
}))
app.component('asyncComponent',Vue.defineAsyncComponent(()=>{return new Promise((reslove,reject)=>{setTimeout(()=>{reslove({template: `<h1>123<h1/>`})},3000)})
}))
配合webpack打包分片