29 lines
562 B
Vue
Raw Normal View History

2022-12-05 23:01:12 +08:00
<template>
2023-02-20 14:41:26 +08:00
<component :is="icon" :class="className" />
2022-12-05 23:01:12 +08:00
</template>
<script setup>
import { computed } from 'vue'
import * as heroIcons from '@heroicons/vue/24/outline'
const props = defineProps({
2023-02-20 14:41:26 +08:00
name: {
type: String,
required: true,
},
className: {
type: String,
2023-02-21 09:58:42 +08:00
required: false,
2023-02-20 14:41:26 +08:00
default: "w-5 h-5"
}
2022-12-05 23:01:12 +08:00
})
const icon = computed(() => {
2023-02-20 14:41:26 +08:00
let name = ''
props.name.split('-').forEach(v => {
name += v[0].toUpperCase() + v.substr(1)
})
return heroIcons[name + 'Icon']
2022-12-05 23:01:12 +08:00
})
</script>