diff --git a/src/components/common/IconSelect/index.vue b/src/components/common/IconSelect/index.vue index a79ce678c..42f334357 100644 --- a/src/components/common/IconSelect/index.vue +++ b/src/components/common/IconSelect/index.vue @@ -3,7 +3,7 @@ @@ -31,10 +31,12 @@ import { Icon } from '@iconify/vue'; import { useThemeStore } from '@/store'; interface Props { - /** 绑定的图标 */ + /** 选中的图标 */ value: string; /** 图标列表 */ - icons?: string[]; + icons: string[]; + /** 未选中图标 */ + emptyIcon?: string; } interface Emits { @@ -42,14 +44,14 @@ interface Emits { } const props = withDefaults(defineProps(), { - icons: () => [] + emptyIcon: 'mdi:apps' }); const emit = defineEmits(); const theme = useThemeStore(); const searchValue = ref(''); - +const iconsList = computed(() => props.icons.filter(v => v.includes(searchValue.value))); const modelValue = computed({ get() { return props.value; @@ -59,8 +61,6 @@ const modelValue = computed({ } }); -const iconsList = computed(() => props.icons.filter(v => v.includes(searchValue.value))); - function handleChange(iconItem: string) { modelValue.value = iconItem; }