From 06acd5cf402b374069ee799f6f032c19cda8aa4c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kuikui=20SHANG=E5=B0=9A=E9=AD=81=E9=AD=81?= Date: Mon, 15 Oct 2018 18:33:37 +0800 Subject: [PATCH 1/2] =?UTF-8?q?[=E5=AE=8C=E5=96=84popup=E7=BB=84=E5=BB=BA]?= =?UTF-8?q?=20=E5=BD=93popup=E5=B5=8C=E5=A5=97=E6=97=B6=EF=BC=8C=E5=85=B3?= =?UTF-8?q?=E9=97=ADmodal=E5=B1=82=E7=BA=A7=E9=94=99=E4=B9=B1=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/utils/popup/popup-manager.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/utils/popup/popup-manager.js b/src/utils/popup/popup-manager.js index c7a83a3e..99bce558 100644 --- a/src/utils/popup/popup-manager.js +++ b/src/utils/popup/popup-manager.js @@ -26,6 +26,22 @@ const getModal = function() { return modalDom; }; +/** + * 判断modalDom 是否是再其他 popup中嵌套,如果是嵌套则将modal 移动到最外层modal的父节点下面 + * @param {最后一次生成的modalDom} modalDom + */ +const ifIsNested = function(modalDom) { + if (modalDom) { + if (modalDom.parentNode && modalDom.parentNode !== document.body) { + if (modalDom.parentNode.parentNode && modalDom.parentNode.parentNode.className && modalDom.parentNode.parentNode.className.indexOf('mint-popup') !== -1) { + modalDom.parentNode.parentNode.parentNode.appendChild(modalDom) + } else { + isNested(modalDom.parentNode) + } + } + } +} + const instances = {}; const PopupManager = { From 8a4af05d0434958b63997c14fcd16c7f9c0bf0eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kuikui=20SHANG=E5=B0=9A=E9=AD=81=E9=AD=81?= Date: Mon, 15 Oct 2018 19:29:19 +0800 Subject: [PATCH 2/2] =?UTF-8?q?[=E5=AE=8C=E5=96=84popup=E7=BB=84=E5=BB=BA]?= =?UTF-8?q?=20=E5=BD=93popup=E5=B5=8C=E5=A5=97=E6=97=B6=EF=BC=8C=E5=85=B3?= =?UTF-8?q?=E9=97=ADmodal=E5=B1=82=E7=BA=A7=E9=94=99=E4=B9=B1=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/utils/popup/popup-manager.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/utils/popup/popup-manager.js b/src/utils/popup/popup-manager.js index 99bce558..15698082 100644 --- a/src/utils/popup/popup-manager.js +++ b/src/utils/popup/popup-manager.js @@ -149,6 +149,8 @@ const PopupManager = { } } } + + ifIsNested(modalDom) if (modalStack.length === 0) { if (this.modalFade) {