From 69cb4ad6980cf3abfc6f71e57892fdce510e0da3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E5=A5=95?= Date: Tue, 27 Dec 2016 16:30:06 +0800 Subject: [PATCH] InputNumber: fix float number (#2017) --- packages/input-number/src/input-number.vue | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/input-number/src/input-number.vue b/packages/input-number/src/input-number.vue index 751a4211c..69243bb05 100644 --- a/packages/input-number/src/input-number.vue +++ b/packages/input-number/src/input-number.vue @@ -126,10 +126,10 @@ }, computed: { minDisabled() { - return this.value - this.step < this.min; + return this.accSub(this.value, this.step) < this.min; }, maxDisabled() { - return this.value + this.step > this.max; + return this.accAdd(this.value, this.step) > this.max; } }, methods: { @@ -181,13 +181,13 @@ increase() { if (this.maxDisabled) return; const value = this.value || 0; - if (value + this.step > this.max || this.disabled) return; + if (this.accAdd(value, this.step) > this.max || this.disabled) return; this.currentValue = this.accAdd(this.step, value); }, decrease() { if (this.minDisabled) return; const value = this.value || 0; - if (value - this.step < this.min || this.disabled) return; + if (this.accSub(value, this.step) < this.min || this.disabled) return; this.currentValue = this.accSub(value, this.step); }, handleBlur() {