Fixed #453 - Can't type - as first symbol into an Inputnumber

pull/457/head
mertsincan 2020-08-27 14:20:48 +03:00
parent 19252e6b68
commit 91ebe9dd66
1 changed files with 7 additions and 0 deletions

View File

@ -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;
}