From e7ffe5659f549b26ac030dc79701911d24cbd83e Mon Sep 17 00:00:00 2001 From: rickcole Date: Mon, 1 Jun 2020 14:19:26 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=88=A4=E6=96=AD=E9=80=BB?= =?UTF-8?q?=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Drawer.tsx | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/components/Drawer.tsx b/src/components/Drawer.tsx index 200d8abb..7da980b3 100644 --- a/src/components/Drawer.tsx +++ b/src/components/Drawer.tsx @@ -115,15 +115,15 @@ export class Drawer extends React.Component { const isLeftButton = (e.button === 1 && window.event !== null) || e.button === 0; - this.isRootClosed = - !!( - isLeftButton && - closeOnOutside && - target && - this.modalDom && - !this.modalDom.contains(target) && - !target.closest('[role=dialog]') - ) || target.matches(`.${ns}Drawer-overlay.in`); // 干脆过滤掉来自弹框里面的点击 + this.isRootClosed = !!( + isLeftButton && + closeOnOutside && + target && + this.modalDom && + ((!this.modalDom.contains(target) && !target.closest('[role=dialog]')) || + (target.matches(`.${ns}Drawer-overlay`) && + target.parentElement === this.modalDom)) + ); // 干脆过滤掉来自弹框里面的点击 } @autobind