Explorar o código

input-number allow input '.' '-'

linzer %!s(int64=7) %!d(string=hai) anos
pai
achega
3eb06dcb0e
Modificáronse 1 ficheiros con 9 adicións e 0 borrados
  1. 9 0
      packages/input-number/src/input-number.vue

+ 9 - 0
packages/input-number/src/input-number.vue

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