javascript
//模版调用
<component :is="geticon(item.icon)" />
//引入
import { ref, onMounted, markRaw, defineAsyncComponent } from 'vue';
//异步添加icon图标组建
function geticon(params) {
const modules = import.meta.glob('../components/icons/*.vue');
const link = modules[`../components/icons/${params}.vue`]
return markRaw(defineAsyncComponent(link))
}