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


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM