ソースを参照

fix(stepper): not emit change when min or max.

famanoder 6 年 前
コミット
1f4ad2bb80
2 ファイル変更10 行追加7 行削除
  1. 2 1
      src/packages/stepper/demo.vue
  2. 8 6
      src/packages/stepper/stepper.vue

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

@@ -74,7 +74,8 @@ export default {
     blur(e, v) {
       console.log('blur,', e, v)
     },
-    add() {
+    add(v) {
+      console.log(v)
       this.val1 = Number(this.val1) + 1;
     },
     reduce() {

+ 8 - 6
src/packages/stepper/stepper.vue

@@ -180,10 +180,11 @@ export default {
                         this.animTranslate_add = 0;
                     });
                 };
+                this.$emit('update:value', this.num);
+                this.$emit('add', this.num); 
+                this.$emit('change', this.num); 
             }
-            this.$emit('update:value', this.num);
-            this.$emit('add', this.num); 
-            this.$emit('change', this.num); 
+            
         },
         animEnd() {
             // unbind
@@ -207,10 +208,11 @@ export default {
                         this.animTranslate_ = -100;
                     }); 
                 }    
+                this.$emit('update:value', this.num);
+                this.$emit('reduce', this.num);
+                this.$emit('change', this.num);
             }
-            this.$emit('update:value', this.num);
-            this.$emit('reduce', this.num);
-            this.$emit('change', this.num);
+            
         },
 
     }