From 6cd01c2647be1417e03cdef58e76c22b9caa6eb3 Mon Sep 17 00:00:00 2001 From: kingwl <805037171@163.com> Date: Thu, 24 Nov 2016 14:48:56 +0800 Subject: [PATCH] InputNumber: fix invalid value (#1330) --- packages/input-number/src/input-number.vue | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/packages/input-number/src/input-number.vue b/packages/input-number/src/input-number.vue index 3487f7683..f014a0584 100644 --- a/packages/input-number/src/input-number.vue +++ b/packages/input-number/src/input-number.vue @@ -175,15 +175,17 @@ return (arg1 + arg2) / m; }, increase() { - if (this.value + this.step > this.max || this.disabled) return; - this.currentValue = this.accAdd(this.step, this.value); + const value = this.value || 0; + if (value + this.step > this.max || this.disabled) return; + this.currentValue = this.accAdd(this.step, value); if (this.maxDisabled) { this.inputActive = false; } }, decrease() { - if (this.value - this.step < this.min || this.disabled) return; - this.currentValue = this.accSub(this.value, this.step); + const value = this.value || 0; + if (value - this.step < this.min || this.disabled) return; + this.currentValue = this.accSub(value, this.step); if (this.minDisabled) { this.inputActive = false; }