ソースを参照

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

suzigang 5 年 前
コミット
783aa94680
1 ファイル変更4 行追加5 行削除
  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;
       const status = this.isActive;
       if (!this.disabled) {
       if (!this.disabled) {
         this.isActive = !status;
         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);
     },
     },
   },
   },
 };
 };