const name = 'c1' const currentComponent = shallowRef() const components = import.meta.glob("./a/*.vue"); currentComponent.value = defineAsyncComponent(components['./a/'+name+'.vue'])
<component v-bind:is="currentComponent"></component>
参考:https://cn.vitejs.dev/guide/features.html#glob-import
标签:currentComponent,const,defineAsyncComponent,vue3,import,vite From: https://www.cnblogs.com/alpiny/p/16801283.html