在我的项目中,我希望将组件作为异步组件加载。我发现我可以使用"defineAsyncComponent",但它只是加载默认模块。是否可以加载其他模块?例如,异步加载import {ArrowLeftOutlined, UploadOutlined} from '@ant-design/icons-vue'?
const asyncBbox = defineAsyncComponent({
loader: () => new Promise((resolve) => {
if (componentName)
resolve(import('./example-label-component'));
resolve({
template: '<div>Undefined Component</div>'
})
}),
timeout: 3000
});发布于 2021-08-02 04:24:09
只要是Vue组件,就应该可以通过将其声明为变量来加载您想要的任何组件:
const myCustomComponent = defineAsyncComponent(() => import('@/ant-design/icons/ArrowLeftOutlined.vue'))https://stackoverflow.com/questions/68616141
复制相似问题