perf: 优化图标选择器IconSelect组件 (#554)

* fix: 修复图标选择器未能正确初始化的问题(fix: #552)

* Update Select.vue

---------

Co-authored-by: xiaoming <1923740402@qq.com>
This commit is contained in:
Netfan 2023-05-16 14:29:16 +08:00 committed by GitHub
parent 730bae4bdb
commit d5fdc0449a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -105,7 +105,8 @@ watch(
props.modelValue.indexOf(":") + 1
);
}
}
},
{ immediate: true }
);
watch(
() => {
@ -140,12 +141,11 @@ watch(
</template>
<el-input
class="p-2"
class="px-2 pt-2"
v-model="filterValue"
placeholder="搜索图标"
clearable
/>
<el-divider border-style="dashed" />
<el-tabs v-model="currentActiveType" @tab-click="handleClick">
<el-tab-pane
@ -154,24 +154,26 @@ watch(
:label="pane.label"
:name="pane.name"
>
<el-divider class="tab-divider" border-style="dashed" />
<el-scrollbar height="220px">
<ul class="flex flex-wrap px-2 ml-2">
<li
v-for="(item, key) in pageList"
:key="key"
:title="item"
class="icon-item p-2 w-[1/10] cursor-pointer mr-2 mt-1 flex justify-center items-center border border-solid"
class="icon-item p-2 cursor-pointer mr-2 mt-1 flex justify-center items-center border border-solid"
:style="iconItemStyle(item)"
@click="onChangeIcon(item)"
>
<IconifyIconOnline :icon="currentActiveType + item" />
<IconifyIconOnline
:icon="currentActiveType + item"
width="20px"
height="20px"
/>
</li>
</ul>
</el-scrollbar>
</el-tab-pane>
</el-tabs>
<el-divider border-style="dashed" />
<el-pagination
small
@ -190,14 +192,6 @@ watch(
</template>
<style lang="scss" scoped>
.el-divider--horizontal {
margin: 1px auto !important;
}
.tab-divider.el-divider--horizontal {
margin: 0 !important;
}
.icon-item {
&:hover {
color: var(--el-color-primary);
@ -234,5 +228,10 @@ watch(
:deep(.el-tabs__nav-wrap) {
position: static;
margin: 0;
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.06);
}
:deep(.el-tabs__content) {
margin-top: 4px;
}
</style>