实际使用可能是通过动态请求异步组件的 JS 地址,这个为什么体现不出来
来源:3-12 异步组件(Promise)

慕娘6538821
2019-09-16
main.js 这样写
<button @click="show = true">Load Tooltip</button>
<div v-if="show">
<MyAsyncComponent />
</div>
data(){
return {
show: false }
}
components: {
HelloWorld,
NavigationLink,
MyAsyncComponent:()=>import('./components/my-async-component')
},
写回答
2回答
-
慕娘6538821
提问者
2019-09-16
打了新chunk,但是在show设置为true的时候,没有体现加载js
022020-06-22 -
ustbhuangyi
2019-09-16
这个应该是可以的吧,webpack 会把 my-async-component 打包到一个新的 chunk 中。
00
相似问题