//判空
if (this.form.oneWeight) {
this.form.inCount = this.form.oneCount * this.form.oneWeight
const x = new Decimal(this.form.oneCount);
const result = x.mul(this.form.oneWeight);
if(new Decimal(this.form.oneCount).mul(new Decimal(this.form.oneWeight)).d[1]){
var numFloat = new Decimal(this.form.oneCount).mul(new Decimal(this.form.oneWeight)).d[1]
var numFloat1 = new Decimal(this.form.oneCount).mul(new Decimal(this.form.oneWeight)).d[0]
var FloatNum = Number('0.' + numFloat)
var sum = numFloat1 + FloatNum
this.form.inCount = sum
}
}
使用js乘法 精度错乱 使用Decimal插件处理格式问题
最新推荐文章于 2024-05-30 11:27:58 发布