From 4253b2afbb0307a9a92e0a053b0e4757558252e1 Mon Sep 17 00:00:00 2001
From: LiuHao <liuhaoai545@gmail.com>
Date: 星期一, 18 三月 2024 14:19:30 +0800
Subject: [PATCH] update 增加子流程多实例
---
src/components/IconSelect/index.vue | 42 +++++++++++++++++++-----------------------
1 files changed, 19 insertions(+), 23 deletions(-)
diff --git a/src/components/IconSelect/index.vue b/src/components/IconSelect/index.vue
index 22b9484..3bfde4d 100644
--- a/src/components/IconSelect/index.vue
+++ b/src/components/IconSelect/index.vue
@@ -1,25 +1,25 @@
<template>
- <div class="relative" :style="{ width: width }">
- <el-input v-model="modelValue" readonly @click="visible = !visible" placeholder="鐐瑰嚮閫夋嫨鍥炬爣">
+ <div class="relative" :style="{ 'width': width }">
+ <el-input v-model="modelValue" readonly placeholder="鐐瑰嚮閫夋嫨鍥炬爣" @click="visible = !visible">
<template #prepend>
- <svg-icon :icon-class="modelValue as string" />
+ <svg-icon :icon-class="modelValue" />
</template>
</el-input>
<el-popover shadow="none" :visible="visible" placement="bottom-end" trigger="click" :width="450">
<template #reference>
- <div @click="visible = !visible" class="cursor-pointer text-[#999] absolute right-[10px] top-0 height-[32px] leading-[32px]">
+ <div class="cursor-pointer text-[#999] absolute right-[10px] top-0 height-[32px] leading-[32px]" @click="visible = !visible">
<i-ep-caret-top v-show="visible"></i-ep-caret-top>
<i-ep-caret-bottom v-show="!visible"></i-ep-caret-bottom>
</div>
</template>
- <el-input class="p-2" v-model="filterValue" placeholder="鎼滅储鍥炬爣" clearable @input="filterIcons" />
+ <el-input v-model="filterValue" class="p-2" placeholder="鎼滅储鍥炬爣" clearable @input="filterIcons" />
<el-scrollbar height="w-[200px]">
<ul class="icon-list">
<el-tooltip v-for="(iconName, index) in iconNames" :key="index" :content="iconName" placement="bottom" effect="light">
- <li :class="['icon-item', {active: modelValue == iconName}]" @click="selectedIcon(iconName)">
+ <li :class="['icon-item', { active: modelValue == iconName }]" @click="selectedIcon(iconName)">
<svg-icon color="var(--el-text-color-regular)" :icon-class="iconName" />
</li>
</el-tooltip>
@@ -31,17 +31,11 @@
<script setup lang="ts">
import icons from '@/components/IconSelect/requireIcons';
+import { propTypes } from '@/utils/propTypes';
const props = defineProps({
- modelValue: {
- type: String,
- require: true
- },
- width: {
- type: String,
- require: false,
- default: '400px'
- }
+ modelValue: propTypes.string.isRequired,
+ width: propTypes.string.def('400px')
});
const emit = defineEmits(['update:modelValue']);
@@ -56,13 +50,11 @@
*/
const filterIcons = () => {
if (filterValue.value) {
- iconNames.value = icons.filter(iconName =>
- iconName.includes(filterValue.value)
- );
+ iconNames.value = icons.filter((iconName) => iconName.includes(filterValue.value));
} else {
iconNames.value = icons;
}
-}
+};
/**
* 閫夋嫨鍥炬爣
* @param iconName 閫夋嫨鐨勫浘鏍囧悕绉�
@@ -70,10 +62,14 @@
const selectedIcon = (iconName: string) => {
emit('update:modelValue', iconName);
visible.value = false;
-}
+};
</script>
<style scoped lang="scss">
+.el-scrollbar {
+ max-height: calc(50vh - 100px) !important;
+ overflow-y: auto;
+}
.el-divider--horizontal {
margin: 10px auto !important;
}
@@ -101,8 +97,8 @@
}
}
.active {
- border-color: var(--el-color-primary);
- color: var(--el-color-primary);
- }
+ border-color: var(--el-color-primary);
+ color: var(--el-color-primary);
+ }
}
</style>
--
Gitblit v1.9.3