From 941ad59759cbd5a5e39bcdf29783d8eea85caf72 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=97=A0=E6=9C=A8?= Date: Sun, 27 Jun 2021 19:13:57 +0800 Subject: [PATCH] fix(drawer): openDrawer is not normal in some cases MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修复BasicDrawer在设置其它属性时可能会影响visible状态的问题 --- src/components/Drawer/src/BasicDrawer.vue | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/components/Drawer/src/BasicDrawer.vue b/src/components/Drawer/src/BasicDrawer.vue index fe658ef4..980a8cb3 100644 --- a/src/components/Drawer/src/BasicDrawer.vue +++ b/src/components/Drawer/src/BasicDrawer.vue @@ -37,7 +37,6 @@ defineComponent, ref, computed, - watchEffect, watch, unref, nextTick, @@ -135,9 +134,13 @@ return !!unref(getProps)?.loading; }); - watchEffect(() => { - visibleRef.value = props.visible; - }); + watch( + () => props.visible, + (newVal, oldVal) => { + if (newVal != oldVal) visibleRef.value = newVal; + }, + { deep: true } + ); watch( () => visibleRef.value, -- GitLab