bignumber.js

npm install bignumber.js

在vue文件中引用

import BigNumber from "bignumber.js";

加法和减法

  for (let i = 0; i < list.length; i++) {
        // subWeight += Number(list[i].itemWeight);
        subWeight = BigNumber(subWeight).plus(Number(list[i].itemWeight));
      }
      // allowSubWeight = allowSubWeight - subWeight;
      allowSubWeight = new BigNumber(allowSubWeight).minus(subWeight);

 

 

 

https://www.cnblogs.com/xianfengzhike/p/9939012.html

https://www.cnblogs.com/wjs0509/p/14355453.html

posted @ 2021-05-07 11:30  ThisCall  阅读(1292)  评论(0编辑  收藏  举报