From 37464c6c348470f143f16c3b1160767c32c27327 Mon Sep 17 00:00:00 2001 From: ocean-gao Date: Fri, 1 Nov 2024 15:24:57 +0800 Subject: [PATCH] =?UTF-8?q?fix(Switch):=20=E4=BF=AE=E5=A4=8D=20onMounted?= =?UTF-8?q?=20=E5=88=9D=E5=A7=8B=E5=80=BC=E8=AE=BE=E7=BD=AE=E4=B8=8D?= =?UTF-8?q?=E7=94=9F=E6=95=88=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/switch/switch.vue | 2 +- docs/.vitepress/components/switch/common.vue | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/components/switch/switch.vue b/components/switch/switch.vue index 79fe06fb..a9f29eb4 100644 --- a/components/switch/switch.vue +++ b/components/switch/switch.vue @@ -79,7 +79,7 @@ export default defineComponent({ const { validate, isFormDisabled } = useFormAdaptor(); onMounted(() => { // 默认为未选中 - if (currentValue.value === undefined) { + if (currentValue.value === undefined && props.inactiveValue !== undefined) { // 避免可能出现的bug https://github.com/vuejs/core/issues/5290 nextTick(() => { updateCurrentValue(props.inactiveValue); diff --git a/docs/.vitepress/components/switch/common.vue b/docs/.vitepress/components/switch/common.vue index f7969d4a..fac23824 100644 --- a/docs/.vitepress/components/switch/common.vue +++ b/docs/.vitepress/components/switch/common.vue @@ -3,7 +3,7 @@