简单实用计算属性,算乘除

```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;

                },

```

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容