Kaynağa Gözat

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

vben 4 yıl önce
ebeveyn
işleme
9c02d8ec08
1 değiştirilmiş dosya ile 4 ekleme ve 1 silme
  1. 4 1
      src/components/Modal/src/Modal.tsx

+ 4 - 1
src/components/Modal/src/Modal.tsx

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