Commit 941ad59759cbd5a5e39bcdf29783d8eea85caf72

Authored by 无木
1 parent d0b6c496

fix(drawer): openDrawer is not normal in some cases

修复BasicDrawer在设置其它属性时可能会影响visible状态的问题
src/components/Drawer/src/BasicDrawer.vue
@@ -37,7 +37,6 @@ @@ -37,7 +37,6 @@
37 defineComponent, 37 defineComponent,
38 ref, 38 ref,
39 computed, 39 computed,
40 - watchEffect,  
41 watch, 40 watch,
42 unref, 41 unref,
43 nextTick, 42 nextTick,
@@ -135,9 +134,13 @@ @@ -135,9 +134,13 @@
135 return !!unref(getProps)?.loading; 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 watch( 145 watch(
143 () => visibleRef.value, 146 () => visibleRef.value,