diff --git a/src/components/IconPicker/src/IconPicker.vue b/src/components/IconPicker/src/IconPicker.vue index 0af1faa..6febb43 100644 --- a/src/components/IconPicker/src/IconPicker.vue +++ b/src/components/IconPicker/src/IconPicker.vue @@ -52,7 +52,7 @@ const tabChange = () => { currentPage.value = 1 } -const pageSize = ref(63) +const pageSize = ref(49) const currentPage = ref(1) @@ -78,7 +78,7 @@ async function init(icon?: string) { iconName.value = iconInfo[0] const wrapIndex = icons.findIndex((item) => item.prefix === iconInfo[0]) // 查询当前icon的索引 - const index = icons[wrapIndex].icons.findIndex((item) => item === icon) + const index = filterItemIcons(icons[wrapIndex].icons).findIndex((item) => item === icon) // 计算当前icon的页码 await nextTick() currentPage.value = Math.ceil((index + 1) / unref(pageSize)) @@ -91,6 +91,16 @@ const popoverShow = () => { const iconSelect = (icon: string) => { modelValue.value = icon } + +const search = ref('') + +const filterItemIcons = (icons: string[]) => { + return icons.filter((item) => item.includes(unref(search))) +} + +const inputClear = () => { + init(unref(modelValue)) +}