瀏覽代碼

fix:组件修改名称后更新表达式中数据集的名称

liu.shiyi 1 年之前
父節點
當前提交
f8fcc8f2e6

+ 0 - 7
data-room-ui/packages/BasicComponents/Numbers/setting.vue

@@ -176,13 +176,6 @@ export default {
     }
   },
   watch: {
-    // 标题发生变化时需要及时更新表达式中的数据集库的字段名
-    'config.title': {
-      handler (val, oldVal) {
-        this.updateDataset({ code: this.config.code, title: val, data: [], oldTitle: oldVal, isChangeTitle: true })
-        this.updateComputedDatas({ code: this.config.code, title: val, data: [], oldTitle: oldVal, isChangeTitle: true })
-      }
-    }
   },
   mounted () {},
   methods: {

+ 0 - 7
data-room-ui/packages/BasicComponents/Texts/setting.vue

@@ -173,13 +173,6 @@ export default {
     }
   },
   watch: {
-    // 标题发生变化时需要及时更新表达式中的数据集库的字段名
-    'config.title': {
-      handler (val, oldVal) {
-        this.updateDataset({ code: this.config.code, title: val, data: [], oldTitle: oldVal, isChangeTitle: true })
-        this.updateComputedDatas({ code: this.config.code, title: val, data: [], oldTitle: oldVal, isChangeTitle: true })
-      }
-    }
   },
   mounted () {},
   methods: {

+ 7 - 0
data-room-ui/packages/js/mixins/commonMixins.js

@@ -25,6 +25,13 @@ export default {
         this.getDataByExpression(this.config)
       }
     },
+    // 标题发生变化时需要及时更新表达式中的数据集库的字段名
+    'config.title': {
+      handler (val, oldVal) {
+        this.updateDataset({ code: this.config.code, title: val, data: [], oldTitle: oldVal, isChangeTitle: true })
+        this.updateComputedDatas({ code: this.config.code, title: val, data: [], oldTitle: oldVal, isChangeTitle: true })
+      }
+    },
     currentDataset: { // 关联的数据发生变化
       handler (val, old) {
         if (val && Object.keys(val).length && JSON.stringify(val) !== JSON.stringify(old)) {