Input-Number: Fix precision problem (#15292) (#15295)

This commit is contained in:
susiwen8
2019-05-07 12:28:04 +08:00
committed by iamkun
parent d8002ccb07
commit af0dc358bc

View File

@@ -195,7 +195,7 @@
methods: {
toPrecision(num, precision) {
if (precision === undefined) precision = this.numPrecision;
return parseFloat(Number(num).toFixed(precision));
return parseFloat(Math.round(num * Math.pow(10, precision)) / Math.pow(10, precision));
},
getPrecision(value) {
if (value === undefined) return 0;