Skip to content

Commit

Permalink
fix: switch
Browse files Browse the repository at this point in the history
  • Loading branch information
sanqi-med committed Jul 27, 2023
1 parent 46ddb2c commit 4d3d651
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions packages/quarkd/src/switch/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,11 @@ class QuarkSwitch extends QuarkElement {
if (this.disabled || this.loading) {
return;
}

this.checked = !this.checked;
// 注册 change 函数,供外部使用 <quark-switch @change={} />
// 完全受控组件,内部不需要更改this.check
const newValue = !this.checked;
this.$emit("change", {
detail: {
value: this.checked,
value: newValue,
},
});
};
Expand Down

0 comments on commit 4d3d651

Please sign in to comment.