vue 使用 currency.js 处理 小数的相加减 精度问题

vue 使用 currency.js 处理 小数的相加减 精度问题

安装 currency.js

npm install --save currency.js

或者

yarn add currency.js

引入

在需要用到的地方

import currency from 'currency.js'

使用

// number1,number2 就是你想要相加的数
currency(number1).add(number2)

其他需求详情可参考 currency.js 官网

猜你喜欢

转载自blog.csdn.net/weixin_44872023/article/details/121697506