code refactor

This commit is contained in:
MaysWind
2025-01-11 13:59:47 +08:00
parent 61f26e060e
commit 89b233e51b
25 changed files with 128 additions and 128 deletions
+4 -4
View File
@@ -37,7 +37,7 @@
</template>
<script setup lang="ts">
import { type Ref, ref, computed, useTemplateRef, nextTick } from 'vue';
import { ref, computed, useTemplateRef, nextTick } from 'vue';
import type { ColorValue } from '@/core/color.ts';
import type { IconInfo, IconInfoWithId } from '@/core/icon.ts';
@@ -60,7 +60,7 @@ const props = defineProps<{
}>();
const emit = defineEmits<{
(e: 'update:modelValue', value: string): void
(e: 'update:modelValue', value: string): void;
}>();
const icons = {
@@ -68,13 +68,13 @@ const icons = {
};
const dropdownMenu = useTemplateRef<HTMLElement>('dropdownMenu');
const itemPerRow: Ref<number> = ref(props.columnCount || 7);
const itemPerRow = ref<number>(props.columnCount || 7);
const allIconRows = computed<IconInfoWithId[][]>(() => {
return getIconsInRows(props.allIconInfos, itemPerRow.value);
});
const icon = computed({
const icon = computed<string>({
get: () => props.modelValue,
set: (value: string) => emit('update:modelValue', value)
});