```js
// 计算属性使用方法
//下需要用到的地方直接调用,在computer中返回计算结果
computed: {
computerNumer: function () {
const self = this;
if(self.curArithmetic == '乘') {
let res = self.exr * self.curMoney
return vm.paymentVoList[curIndex].convertTotal = res.toFixed(2);
}
if(self.curArithmetic == '除') {
let res = self.curMoney / self.exr;
return vm.paymentVoList[curIndex].convertTotal = res.toFixed(2);
}
}
},
calculateDiscount: function(e,arithmetic,money,index) {
const self = this;
self.exr = e.target.value;
self.curArithmetic = arithmetic;
self.curMoney = money;
curIndex = index;
vm.computerNumer;
},
```
网友评论