fix:表达式优化:第一次添加表达式(或清空后)不带加号

main
liu.shiyi 1 year ago
parent ddfa67b454
commit 110d53712c

@ -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)

Loading…
Cancel
Save