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