Skip to content

Commit

Permalink
feat(projects): 图标选择器增加扩展树形
Browse files Browse the repository at this point in the history
  • Loading branch information
yanbowe committed Dec 18, 2021
1 parent 9472b51 commit 041012b
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/components/common/IconSelect/index.vue
Expand Up @@ -3,7 +3,7 @@
<template #trigger>
<n-input v-model:value="modelValue" readonly placeholder="点击选择图标">
<template #suffix>
<Icon :icon="modelValue ? modelValue : 'mdi:apps'" class="text-30px p-5px" />
<Icon :icon="modelValue ? modelValue : emptyIcon" class="text-30px p-5px" />
</template>
</n-input>
</template>
Expand Down Expand Up @@ -31,25 +31,27 @@ import { Icon } from '@iconify/vue';
import { useThemeStore } from '@/store';
interface Props {
/** 绑定的图标 */
/** 选中的图标 */
value: string;
/** 图标列表 */
icons?: string[];
icons: string[];
/** 未选中图标 */
emptyIcon?: string;
}
interface Emits {
(e: 'update:value', val: string): void;
}
const props = withDefaults(defineProps<Props>(), {
icons: () => []
emptyIcon: 'mdi:apps'
});
const emit = defineEmits<Emits>();
const theme = useThemeStore();
const searchValue = ref('');
const iconsList = computed(() => props.icons.filter(v => v.includes(searchValue.value)));
const modelValue = computed({
get() {
return props.value;
Expand All @@ -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;
}
Expand Down

0 comments on commit 041012b

Please sign in to comment.