瀏覽代碼

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

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

* Update Select.vue

---------

Co-authored-by: xiaoming <1923740402@qq.com>
Netfan 1 年之前
父節點
當前提交
d5fdc0449a
共有 1 個文件被更改,包括 14 次插入15 次删除
  1. 14 15
      src/components/ReIcon/src/Select.vue

+ 14 - 15
src/components/ReIcon/src/Select.vue

@@ -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>