From 110d53712c6dfe09a52cb819291a9706339c0208 Mon Sep 17 00:00:00 2001 From: "liu.shiyi" Date: Tue, 7 Nov 2023 17:19:17 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E8=A1=A8=E8=BE=BE=E5=BC=8F=E4=BC=98?= =?UTF-8?q?=E5=8C=96=EF=BC=9A=E7=AC=AC=E4=B8=80=E6=AC=A1=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E8=A1=A8=E8=BE=BE=E5=BC=8F=EF=BC=88=E6=88=96=E6=B8=85=E7=A9=BA?= =?UTF-8?q?=E5=90=8E=EF=BC=89=E4=B8=8D=E5=B8=A6=E5=8A=A0=E5=8F=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BigScreenDesign/RightSetting/ExpressionDialog.vue | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/data-room-ui/packages/BigScreenDesign/RightSetting/ExpressionDialog.vue b/data-room-ui/packages/BigScreenDesign/RightSetting/ExpressionDialog.vue index 1f4efcc5..a857c109 100644 --- a/data-room-ui/packages/BigScreenDesign/RightSetting/ExpressionDialog.vue +++ b/data-room-ui/packages/BigScreenDesign/RightSetting/ExpressionDialog.vue @@ -185,7 +185,10 @@ export default { const str = node.value const code = node.code if (node.disabled) return - this.$refs.codemirrorRef.codemirror.setValue(this.currentConfig.expression + ' + ' + str) + // 判断编辑器里面是return + 0或者多个空格 还是包含其他表达式,每次添加第一个表达式时不要加‘+’,防止计算错误 + const isInit = /^[\w\s]+$/.test(this.currentConfig.expression) + const newStr = isInit ? this.currentConfig.expression + str : this.currentConfig.expression + ' + ' + str + this.$refs.codemirrorRef.codemirror.setValue(newStr) // 同时将点击的数据存在expressionCodes中 if (this.currentConfig.expressionCodes && Array.isArray(this.currentConfig.expressionCodes)) { this.currentConfig.expressionCodes.push(code)