mr_web_back/src/components/Icon.vue
2023-06-28 18:44:28 +08:00

24 lines
395 B
Vue

<template>
<template v-if="iconType === 'ElIcon'">
<el-icon>
<component :is="name"></component>
</el-icon>
</template>
</template>
<script setup>
import { ref } from 'vue';
const { name } = defineProps({
name: String
});
const iconType = ref('');
switch (true) {
case name.startsWith('ElIcon'):
iconType.value = 'ElIcon';
break;
default:
break;
}
</script>