Commit 9c02d8ec08b309e7f982f417a4c907f33ccc96f0
1 parent
1c075a7a
fix: fix modal dragging failure when destroyOnClose=true (#51)
Showing
1 changed file
with
4 additions
and
1 deletions
src/components/Modal/src/Modal.tsx
... | ... | @@ -80,17 +80,20 @@ export default defineComponent({ |
80 | 80 | }; |
81 | 81 | }; |
82 | 82 | }; |
83 | + | |
83 | 84 | const handleDrag = () => { |
84 | 85 | const dragWraps = document.querySelectorAll('.ant-modal-wrap'); |
85 | 86 | for (const wrap of dragWraps as any) { |
86 | 87 | const display = getStyle(wrap, 'display'); |
88 | + | |
87 | 89 | const draggable = wrap.getAttribute('data-drag'); |
88 | 90 | if (display !== 'none') { |
89 | 91 | // 拖拽位置 |
90 | - draggable === null && drag(wrap); | |
92 | + (draggable === null || props.destroyOnClose) && drag(wrap); | |
91 | 93 | } |
92 | 94 | } |
93 | 95 | }; |
96 | + | |
94 | 97 | watchEffect(() => { |
95 | 98 | if (!props.visible) { |
96 | 99 | return; | ... | ... |