From 4d3d651e419c80a0a85195cb121e4643a4b7bb44 Mon Sep 17 00:00:00 2001 From: Sanqi Date: Thu, 27 Jul 2023 15:42:27 +0800 Subject: [PATCH] fix: switch --- packages/quarkd/src/switch/index.tsx | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/packages/quarkd/src/switch/index.tsx b/packages/quarkd/src/switch/index.tsx index 216c9469..e7353573 100644 --- a/packages/quarkd/src/switch/index.tsx +++ b/packages/quarkd/src/switch/index.tsx @@ -46,12 +46,11 @@ class QuarkSwitch extends QuarkElement { if (this.disabled || this.loading) { return; } - - this.checked = !this.checked; - // 注册 change 函数,供外部使用 + // 完全受控组件,内部不需要更改this.check + const newValue = !this.checked; this.$emit("change", { detail: { - value: this.checked, + value: newValue, }, }); };