瀏覽代碼

feat:修复输入框主题切换问题

liu.shiyi 1 年之前
父節點
當前提交
a7d2ea859d
共有 1 個文件被更改,包括 12 次插入10 次删除
  1. 12 10
      data-room-ui/packages/BasicComponents/Input/index.vue

+ 12 - 10
data-room-ui/packages/BasicComponents/Input/index.vue

@@ -51,18 +51,18 @@ export default {
     return { }
   },
   watch: {
-    customTheme: {
+    'config.customize': {
       handler () {
-        this.changeStyle(this.config)
-      }
+        this.changeStyle(this.config, true)
+      },
+      deep: true
     }
   },
   mounted () {
     this.chartInit()
-    // this.changeStyle()
   },
   methods: {
-    changeStyle (config) {
+    changeStyle (config, isUpdateTheme) {
       config = { ...this.config, ...config }
       const input = document.querySelector(`#el-input-${config.code}`)
       // const inputIcon = input.querySelector(`.${this.config.customize.icon.name}`)
@@ -79,11 +79,13 @@ export default {
         inputIcon.style.fontSize = config.customize.inputStyle.fontSize + 'px'
       }
       // 样式改变时更新主题配置
-      config.theme = settingToTheme(_.cloneDeep(config), this.customTheme)
-      this.changeChartConfig(config)
-      // if (config.code === this.activeCode) {
-      //   this.changeActiveItemConfig(config)
-      // }
+      if (!isUpdateTheme) {
+        config.theme = settingToTheme(_.cloneDeep(config), this.customTheme)
+        this.changeChartConfig(config)
+        if (config.code === this.activeCode) {
+          this.changeActiveItemConfig(config)
+        }
+      }
     }
   }
 }