Переглянути джерело

perf: 优化层级展示, 优化失焦隐藏代码

奔跑的面条 3 роки тому
батько
коміт
b66205eda9

+ 4 - 7
src/store/modules/chartEditStore/chartEditStore.ts

@@ -843,7 +843,8 @@ export const useChartEditStore = defineStore({
             )
           }
           this.updateComponentList(index, targetItem)
-          this.setTargetSelectChart(undefined)
+          // 锁定添加失焦效果
+          if(status) this.setTargetSelectChart(undefined)
           loadingFinish()
           return
         }
@@ -876,14 +877,10 @@ export const useChartEditStore = defineStore({
             )
           }
           this.updateComponentList(index, targetItem)
-          this.setTargetSelectChart(undefined)
           loadingFinish()
 
-          // 取消选择隐藏
-          if (status) {
-            const chartEditStore = useChartEditStore()
-            chartEditStore.setTargetSelectChart(undefined)
-          }
+          // 隐藏添加失焦效果
+          if (status) this.setTargetSelectChart(undefined)
         }
       } catch (value) {
         loadingError()

+ 15 - 10
src/views/chart/ContentLayers/components/LayersStatus/index.vue

@@ -1,5 +1,5 @@
 <template>
-  <div v-show="!isGroup">
+  <div class="icon-item-box" v-show="!isGroup">
     <n-icon
       class="go-ml-1 icon-item"
       :class="{ active: status.lock }"
@@ -68,15 +68,20 @@ const lockHandle = (e: MouseEvent) => {
 <style lang="scss" scoped>
 $activeColor: v-bind('themeColor');
 
-.icon-item {
-  opacity: 0;
-  padding-top: 5px;
-  &.active,
-  &:hover {
-    color: $activeColor;
-  }
-  &.active {
-    opacity: 1 !important;
+.icon-item-box {
+  white-space: nowrap;
+
+  .icon-item {
+    opacity: 0;
+    padding-top: 5px;
+    @extend.go-transition;
+    &.active,
+    &:hover {
+      color: $activeColor;
+    }
+    &.active {
+      opacity: 1 !important;
+    }
   }
 }
 </style>