input-number allow input '.' '-'

pull/7853/head
linzer 2017-10-30 15:28:45 +08:00 committed by 杨奕
parent 409a3c852f
commit 3eb06dcb0e
1 changed files with 9 additions and 0 deletions

View File

@ -208,6 +208,15 @@
if (value === '') {
return;
}
if (value.indexOf('.') === (value.length - 1)) {
return;
}
if (value.indexOf('-') === (value.length - 1)) {
return;
}
const newVal = Number(value);
if (!isNaN(newVal)) {
this.setCurrentValue(newVal);