input-number allow input '.' '-'

This commit is contained in:
linzer
2017-10-30 15:28:45 +08:00
committed by 杨奕
parent 409a3c852f
commit 3eb06dcb0e

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);