From 91ebe9dd661d6d7ab7050f6aa04d8b28a3d4a732 Mon Sep 17 00:00:00 2001 From: mertsincan Date: Thu, 27 Aug 2020 14:20:48 +0300 Subject: [PATCH] Fixed #453 - Can't type - as first symbol into an Inputnumber --- src/components/inputnumber/InputNumber.vue | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/components/inputnumber/InputNumber.vue b/src/components/inputnumber/InputNumber.vue index 3f935a34dd..abe0e649e9 100755 --- a/src/components/inputnumber/InputNumber.vue +++ b/src/components/inputnumber/InputNumber.vue @@ -165,6 +165,10 @@ export default { }, formatValue(value) { if (value != null) { + if (value === '-') { // Minus sign + return value; + } + if (this.format) { let formatter = new Intl.NumberFormat(this.locale, this.getOptions()); let formattedValue = formatter.format(value); @@ -196,6 +200,9 @@ export default { .replace(this._numeral, this._index); if (filteredText) { + if (filteredText === '-') // Minus sign + return filteredText; + let parsedValue = +filteredText; return isNaN(parsedValue) ? null : parsedValue; }