From 97187b246b94dd58cb585ebaed7e8644d2f00119 Mon Sep 17 00:00:00 2001 From: 疯狂的狮子Li <15040126243@163.com> Date: 星期一, 03 四月 2023 00:26:04 +0800 Subject: [PATCH] update 调整代码格式 --- src/components/IconSelect/index.vue | 90 ++++++++++++++++++++++---------------------- 1 files changed, 45 insertions(+), 45 deletions(-) diff --git a/src/components/IconSelect/index.vue b/src/components/IconSelect/index.vue index 63afe85..330c44f 100644 --- a/src/components/IconSelect/index.vue +++ b/src/components/IconSelect/index.vue @@ -1,48 +1,3 @@ -<script setup lang="ts"> -import icons from '@/components/IconSelect/requireIcons'; - -const props = defineProps({ - modelValue: { - type: String, - require: true - }, - width: { - type: String, - require: false, - default: '400px' - } -}); - -const emit = defineEmits(['update:modelValue']); -const visible = ref(false); -const { modelValue, width } = toRefs(props); -const iconNames = ref<string[]>(icons); - -const filterValue = ref(''); - -/** - * 绛涢�夊浘鏍� - */ -const filterIcons = () => { - if (filterValue.value) { - iconNames.value = icons.filter(iconName => - iconName.includes(filterValue.value) - ); - } else { - iconNames.value = icons; - } -} - -/** - * 閫夋嫨鍥炬爣 - * @param iconName 閫夋嫨鐨勫浘鏍囧悕绉� - */ -const selectedIcon = (iconName: string) => { - emit('update:modelValue', iconName); - visible.value = false; -} -</script> - <template> <div class="relative" :style="{ width: width }"> <el-input v-model="modelValue" readonly @click="visible = !visible" placeholder="鐐瑰嚮閫夋嫨鍥炬爣"> @@ -74,6 +29,51 @@ </div> </template> +<script setup lang="ts"> +import icons from '@/components/IconSelect/requireIcons'; + +const props = defineProps({ + modelValue: { + type: String, + require: true + }, + width: { + type: String, + require: false, + default: '400px' + } +}); + +const emit = defineEmits(['update:modelValue']); +const visible = ref(false); +const { modelValue, width } = toRefs(props); +const iconNames = ref<string[]>(icons); + +const filterValue = ref(''); + +/** + * 绛涢�夊浘鏍� + */ +const filterIcons = () => { + if (filterValue.value) { + iconNames.value = icons.filter(iconName => + iconName.includes(filterValue.value) + ); + } else { + iconNames.value = icons; + } +} + +/** + * 閫夋嫨鍥炬爣 + * @param iconName 閫夋嫨鐨勫浘鏍囧悕绉� + */ +const selectedIcon = (iconName: string) => { + emit('update:modelValue', iconName); + visible.value = false; +} +</script> + <style scoped lang="scss"> .el-divider--horizontal { margin: 10px auto !important; -- Gitblit v1.9.3