Explorar o código

符号添加判断

duy %!s(int64=2) %!d(string=hai) anos
pai
achega
36839d2d36
Modificáronse 1 ficheiros con 8 adicións e 3 borrados
  1. 8 3
      src/views/formula/edit1.vue

+ 8 - 3
src/views/formula/edit1.vue

@@ -969,8 +969,13 @@ export default {
               return;
             }
         }
+        let lastEle = this.selectEleFormula[this.selectEleFormula.length-1];
+        if(this.selectEleFormula.length == 0 && lastEle.type == 'Operator' && lastEle.type == 'Brackets' && lastEle.name == '('){ /* 存在运算符 */
+          this.eleAddFormulaHandle(item);
+        } else {
+          this.itemList.push(item);
+        }
 
-        this.itemList.push(item);
       }else{
            let index = -1;
             for (let i = 0; i < this.itemList.length; i++) {
@@ -987,11 +992,11 @@ export default {
     //快捷添加运算符号
     addOperator(operator){
 
-    
+
       if(  this.itemList.length>0){
           this.itemList.forEach(e => {
             let lastEle = this.selectEleFormula[this.selectEleFormula.length-1];
-            if(this.selectEleFormula.length != 0 && lastEle.type != 'Operator' && lastEle.type != 'Brackets' && lastEle.name != '('){
+            if(this.selectEleFormula.length != 0 && lastEle.type != 'Operator' && lastEle.type != 'Brackets' && lastEle.name != '('){ /* 不存在运算符 */
               this.eleAddFormulaHandle(this.formulaMap[operator]);
             }
             this.eleAddFormulaHandle(e);