Browse Source

fix: 地图组件的颜色配置项优化

hong.yang 1 năm trước cách đây
mục cha
commit
097db38403
1 tập tin đã thay đổi với 7 bổ sung4 xóa
  1. 7 4
      data-room-ui/packages/BasicComponents/Map/setting.vue

+ 7 - 4
data-room-ui/packages/BasicComponents/Map/setting.vue

@@ -422,7 +422,7 @@
               @click="addColor"
             />
             <span
-              v-if="colors.length"
+              v-if="colors.length > 2"
               class="el-icon-remove-outline"
               style="color: #ea0b30; font-size: 20px"
               @click="delColor"
@@ -456,6 +456,7 @@ export default {
   props: {},
   data () {
     return {
+      colors: [],
       mapList: [],
       predefineThemeColors: predefineColors,
       mapTree: [],
@@ -504,6 +505,7 @@ export default {
   watch: {},
   mounted () {
     this.getMapTree()
+    this.colors = this.config.customize.rangeColor
   },
   methods: {
     getMapTree() {
@@ -526,11 +528,12 @@ export default {
       this.getMapTree()
     },
     delColor () {
-      this.colors = []
-      this.config.customize.rangeColor = []
+      if (this.colors.length <= 2) return
+      this.colors.pop()
+      this.config.customize.rangeColor.pop()
     },
     addColor () {
-      this.colors.push('')
+      this.colors.push('#fff')
     },
     updateColorScheme (colors) {
       this.colors = [...colors]