Level 47
don't do this , try defineAsyncComponent
<template>
<Suspense>
<component :is="iconComponent" />
</Suspense>
</template>
<script setup>
import { defineAsyncComponent } from 'vue'
const props = defineProps({
iconName: {
type: String,
}
})
const iconComponent = defineAsyncComponent(() => import(`path${iconName}`))
</script>
In your parent component pass the iconName instead of a function
Note: This is just a concept , you should modify it with your code , don't just copy
1 like