Browse Source

fix(stepper): could clear val and no min val limit when typing.

famanoder 6 years ago
parent
commit
8bbcb5c92e

+ 1 - 1
src/packages/stepper/__test__/stepper.spec.js

@@ -18,7 +18,7 @@ describe('Stepper.vue', () => {
         });
         });
         const input = wraper.find('input');
         const input = wraper.find('input');
         expect(wraper.contains('.nut-stepper-grey')).toBe(true);
         expect(wraper.contains('.nut-stepper-grey')).toBe(true);
-        expect(input.attributes('min')).toBe(minVal);
+        expect(input.attributes('min')).toBe('0');
         expect(input.attributes('max')).toBe(maxVal);
         expect(input.attributes('max')).toBe(maxVal);
     });
     });
 
 

+ 2 - 2
src/packages/stepper/stepper.vue

@@ -124,7 +124,7 @@ export default {
             const v = this.num;
             const v = this.num;
             this.tempNum = v;
             this.tempNum = v;
             this.minNum = '';
             this.minNum = '';
-            this.num = '';
+            // this.num = '';
             this.focusing = true;
             this.focusing = true;
         },
         },
         blur(e) {
         blur(e) {
@@ -142,7 +142,7 @@ export default {
         },
         },
         checknum(e) {
         checknum(e) {
             let v = e.target.value;
             let v = e.target.value;
-            this.minNum = this.min;
+            // this.minNum = this.min;
             this.focusing = false;
             this.focusing = false;
             if(v > this.max) v = this.max;
             if(v > this.max) v = this.max;
             if(v < this.minNum) v = this.minNum;
             if(v < this.minNum) v = this.minNum;