فهرست منبع

公式配置问题

duy 2 سال پیش
والد
کامیت
6344f5c2bd
1فایلهای تغییر یافته به همراه18 افزوده شده و 7 حذف شده
  1. 18 7
      src/views/formula/edit1.vue

+ 18 - 7
src/views/formula/edit1.vue

@@ -985,19 +985,30 @@ export default {
     },
     //快捷添加运算符号
     addOperator(operator){
-      if (this.itemList.length <= 0) {
-         this.eleAddFormulaHandle(this.formulaMap[operator]);
-      }
       
       this.itemList.forEach(e => {
-         this.eleAddFormulaHandle(e);
+          this.eleAddFormulaHandle(e);
         this.eleAddFormulaHandle(this.formulaMap[operator]);
-       
       })
-   
-     
+      
+       
       this.itemList=[]
     },
+    //插入运算符
+   addOperration(text,type){
+      //type 是true 表示在元素右边插入
+      if(this.curSeleEleIndex == Number(this.curSeleEleIndex)){
+        this.eleAddFormulaHandle({
+          type:type,
+          name:text,
+          selectIndex:type?Number(this.curSeleEleIndex)+1:this.curSeleEleIndex
+        })
+        //如果在左边插入index要增1
+        if(!type){
+          this.curSeleEleIndex = Number(this.curSeleEleIndex)+1;
+        }
+      }
+    },
 
     //把元素加到公式里
     eleAddFormulaHandle(ele){