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

pull/15185/head^2
susiwen8 2019-05-07 12:28:04 +08:00 committed by iamkun
parent d8002ccb07
commit af0dc358bc
1 changed files with 1 additions and 1 deletions

View File

@ -195,7 +195,7 @@
methods: { methods: {
toPrecision(num, precision) { toPrecision(num, precision) {
if (precision === undefined) precision = this.numPrecision; 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) { getPrecision(value) {
if (value === undefined) return 0; if (value === undefined) return 0;