我想异步加载一个大组件加快加载速度。我的想法大致如下:
<template>
<div class="code-wrapper">
<div v-if="loading">loading...</div>
<big-component v-else></big-component>
</div>
</template>
<script>
export default {
data(){
return {
loading:true
}
},
mounted(){
//request <big-component> asynchronously here
}
}
</script>
如何使用webpack的代码拆分实现异步组件?