图标工具

This commit is contained in:
Gary Fu
2023-12-24 17:50:48 +08:00
parent 9b777948c9
commit dbc284bf8b
8 changed files with 148 additions and 15 deletions

View File

@@ -1,19 +1,29 @@
<script setup>
defineProps({
import { computed } from 'vue'
import { ICON_PREFIX } from '@/icons'
import kebabCase from 'lodash/kebabCase'
const props = defineProps({
icon: {
type: String,
required: false
}
})
const calcIcon = computed(() => {
if (props.icon) {
return `${ICON_PREFIX}${kebabCase(props.icon)}`
}
return props.icon
})
</script>
<template>
<el-icon
v-if="icon"
v-if="calcIcon"
v-bind="$attrs"
>
<component
:is="icon"
:is="calcIcon"
/>
</el-icon>
</template>