Commit a50c02726f0d109d6da4065cda17dac9ebe4476f

Authored by Aresn
Committed by GitHub
2 parents 4b47f026 815f8354

Merge pull request #2027 from SergioCrisostomo/fix-precision

Check if isNaN so we don't ignore value of zero
Showing 1 changed file with 1 additions and 1 deletions   Show diff stats
src/components/input-number/input-number.vue
... ... @@ -220,7 +220,7 @@
220 220 },
221 221 setValue (val) {
222 222 // 如果 step 是小数,且没有设置 precision,是有问题的
223   - if (this.precision) val = Number(Number(val).toFixed(this.precision));
  223 + if (!isNaN(this.precision)) val = Number(Number(val).toFixed(this.precision));
224 224  
225 225 this.$nextTick(() => {
226 226 this.currentValue = val;
... ...