Skip to content

Commit

Permalink
upd: 修改disable状态下不分发事件
Browse files Browse the repository at this point in the history
  • Loading branch information
szg2008 committed Aug 21, 2020
1 parent f791f76 commit bdcb03b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/packages/switch/demo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
<span slot="title"><nut-switch :disabled="true"></nut-switch></span>
</nut-cell>
<nut-cell>
<span slot="title"><nut-switch @change="onChange" :active="true" :disabled="true"></nut-switch></span>
<span slot="title"><nut-switch :active="true" :disabled="true"></nut-switch></span>
</nut-cell>
</div>
<p>禁用状态下,change事件参数永远为初始值</p>
Expand Down
9 changes: 4 additions & 5 deletions src/packages/switch/switch.vue
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,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);
}
}
};
Expand Down

0 comments on commit bdcb03b

Please sign in to comment.