浏览代码

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;
       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);
     },
   },
 };