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,17 +80,20 @@ export default defineComponent({ | ||
80 | }; | 80 | }; |
81 | }; | 81 | }; |
82 | }; | 82 | }; |
83 | + | ||
83 | const handleDrag = () => { | 84 | const handleDrag = () => { |
84 | const dragWraps = document.querySelectorAll('.ant-modal-wrap'); | 85 | const dragWraps = document.querySelectorAll('.ant-modal-wrap'); |
85 | for (const wrap of dragWraps as any) { | 86 | for (const wrap of dragWraps as any) { |
86 | const display = getStyle(wrap, 'display'); | 87 | const display = getStyle(wrap, 'display'); |
88 | + | ||
87 | const draggable = wrap.getAttribute('data-drag'); | 89 | const draggable = wrap.getAttribute('data-drag'); |
88 | if (display !== 'none') { | 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 | watchEffect(() => { | 97 | watchEffect(() => { |
95 | if (!props.visible) { | 98 | if (!props.visible) { |
96 | return; | 99 | return; |