From a14d6dd2e4d1b20f69989bd8099996d6ffc2e951 Mon Sep 17 00:00:00 2001 From: Sergio Crisostomo Date: Tue, 14 Nov 2017 14:35:42 +0100 Subject: [PATCH] fix checking when temp number is invalid and should be rechecked in "change" event --- src/components/input-number/input-number.vue | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/components/input-number/input-number.vue b/src/components/input-number/input-number.vue index de82103..b11f438 100644 --- a/src/components/input-number/input-number.vue +++ b/src/components/input-number/input-number.vue @@ -258,11 +258,15 @@ let val = event.target.value.trim(); if (event.type == 'input' && val.match(/^\-?\.?$|\.$/)) return; // prevent fire early if decimal. If no more input the change event will fire later - if (event.type == 'change' && Number(val) === this.currentValue) return; // already fired change for input event const {min, max} = this; const isEmptyString = val.length === 0; val = Number(val); + + if (event.type == 'change'){ + if (val === this.currentValue && val > min && val < max) return; // already fired change for input event + } + if (!isNaN(val) && !isEmptyString) { this.currentValue = val; -- libgit2 0.21.4