From 7a0a979506f1de2556636d685cf8a0866711439d Mon Sep 17 00:00:00 2001 From: prefert Date: Fri, 28 Jun 2019 12:59:51 +0800 Subject: [PATCH] fix --- src/components/input-number/input-number.vue | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/components/input-number/input-number.vue b/src/components/input-number/input-number.vue index f3b6e2dc..95103c8a 100644 --- a/src/components/input-number/input-number.vue +++ b/src/components/input-number/input-number.vue @@ -186,8 +186,13 @@ }, precisionValue () { // can not display 1.0 - if(!this.currentValue) return this.currentValue; - return this.precision ? this.currentValue.toFixed(this.precision) : this.currentValue; + // if(!this.currentValue) return this.currentValue; + // return this.precision ? this.currentValue.toFixed(this.precision) : this.currentValue; + let arr = (this.currentValue + '').split('.'); + if (this.precision && arr[1] && this.precision < arr[1].length) { + return this.currentValue.toFixed(this.precision); + } + return this.currentValue; }, formatterValue () { if (this.formatter && this.precisionValue !== null) {