LoongPanel-Asp/web/components/Icon.vue

34 lines
676 B
Vue
Raw Normal View History

2024-06-22 10:54:02 +08:00
<script setup lang="ts">
import { computed } from 'vue';
import * as icons from "lucide-vue-next";
const props = defineProps({
name: {
type: String,
default: 'LayoutGrid'
},
size: Number,
color: String,
strokeWidth: Number,
defaultClass: String,
fill:{
type: String,
default: 'none'
}
})
type IconsType = typeof icons;
const icon = computed(() => {
const iconName = props.name as keyof IconsType;
return icons[iconName] || icons['LayoutGrid'];
});
</script>
<template>
<component
:is="icon"
:size="size"
:color="color"
:stroke-width="strokeWidth" :default-class="defaultClass"
:fill="fill"
/>
</template>