Commit 941ad59759cbd5a5e39bcdf29783d8eea85caf72
1 parent
d0b6c496
fix(drawer): openDrawer is not normal in some cases
修复BasicDrawer在设置其它属性时可能会影响visible状态的问题
Showing
1 changed file
with
7 additions
and
4 deletions
src/components/Drawer/src/BasicDrawer.vue
... | ... | @@ -37,7 +37,6 @@ |
37 | 37 | defineComponent, |
38 | 38 | ref, |
39 | 39 | computed, |
40 | - watchEffect, | |
41 | 40 | watch, |
42 | 41 | unref, |
43 | 42 | nextTick, |
... | ... | @@ -135,9 +134,13 @@ |
135 | 134 | return !!unref(getProps)?.loading; |
136 | 135 | }); |
137 | 136 | |
138 | - watchEffect(() => { | |
139 | - visibleRef.value = props.visible; | |
140 | - }); | |
137 | + watch( | |
138 | + () => props.visible, | |
139 | + (newVal, oldVal) => { | |
140 | + if (newVal != oldVal) visibleRef.value = newVal; | |
141 | + }, | |
142 | + { deep: true } | |
143 | + ); | |
141 | 144 | |
142 | 145 | watch( |
143 | 146 | () => visibleRef.value, | ... | ... |