Browse Source

upd: 修改disable状态下不分发事件

suzigang 5 years ago
parent
commit
783aa94680
1 changed files with 4 additions and 5 deletions
  1. 4 5
      src/packages/switch/switch.vue

+ 4 - 5
src/packages/switch/switch.vue

@@ -38,12 +38,11 @@ export default {
       const status = this.isActive;
       if (!this.disabled) {
         this.isActive = !status;
+        setTimeout(() => {
+          this.$emit('change', this.isActive);
+          this.$emit('update:active', this.isActive);
+        }, 300);
       }
-
-      setTimeout(() => {
-        this.$emit('change', this.isActive);
-        this.$emit('update:active', this.isActive);
-      }, 300);
     },
   },
 };