fix: fix modal dragging failure when destroyOnClose=true (#51)

This commit is contained in:
vben
2020-10-22 23:30:10 +08:00
parent 1c075a7a32
commit 9c02d8ec08

View File

@@ -80,17 +80,20 @@ export default defineComponent({
}; };
}; };
}; };
const handleDrag = () => { const handleDrag = () => {
const dragWraps = document.querySelectorAll('.ant-modal-wrap'); const dragWraps = document.querySelectorAll('.ant-modal-wrap');
for (const wrap of dragWraps as any) { for (const wrap of dragWraps as any) {
const display = getStyle(wrap, 'display'); const display = getStyle(wrap, 'display');
const draggable = wrap.getAttribute('data-drag'); const draggable = wrap.getAttribute('data-drag');
if (display !== 'none') { if (display !== 'none') {
// 拖拽位置 // 拖拽位置
draggable === null && drag(wrap); (draggable === null || props.destroyOnClose) && drag(wrap);
} }
} }
}; };
watchEffect(() => { watchEffect(() => {
if (!props.visible) { if (!props.visible) {
return; return;