Files
certd/packages/ui/certd-client/src/components/icon-select.vue
T

28 lines
768 B
Vue
Raw Normal View History

2024-11-30 01:57:09 +08:00
<template>
<a-select :value="value" :filter-option="true" @update:value="onChange">
2025-06-29 14:09:09 +08:00
<a-select-option v-for="item of options" :key="item.value" :value="item.value" :label="item.label">
2024-11-30 01:57:09 +08:00
<span class="flex-o">
<fs-icon :icon="item.icon" class="fs-16 color-blue mr-5" />
{{ item.label }}
</span>
</a-select-option>
</a-select>
</template>
<script lang="ts" setup>
const props = defineProps<{
options: { value: any; label: string; icon: string }[];
2026-01-20 00:13:05 +08:00
value: any;
2024-11-30 01:57:09 +08:00
}>();
2026-01-20 00:13:05 +08:00
const emit = defineEmits(["update:value", "selected-change"]);
2026-01-20 00:13:05 +08:00
function onChange(value: any) {
const item = props.options.find(item => item.value === value);
2026-01-20 00:13:05 +08:00
emit("update:value", value);
emit("selected-change", {
value,
...item,
});
2026-01-20 00:13:05 +08:00
}
2024-11-30 01:57:09 +08:00
</script>