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