From 4e8e2cdcb436c151800becdd88b7befeaf0ffeb1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AE=87=E5=A4=A9?= Date: Thu, 29 Aug 2019 09:32:14 +0800 Subject: [PATCH] =?UTF-8?q?clickOutside=E5=85=BC=E5=AE=B9=E8=BE=A3?= =?UTF-8?q?=E9=B8=A1=E7=81=AB=E7=8B=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/utils.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/utils.js b/src/utils.js index 5026df8..8ad4c53 100644 --- a/src/utils.js +++ b/src/utils.js @@ -98,9 +98,12 @@ export const clickOutside = function(dom, fn = noop) { } } } else { - var target = ev.originalTarget || ev.target - console.log(target, typeof target, target.__proto__) - if (dom === target || dom.contains(target)) { + var target = ev.explicitOriginalTarget || ev.target + if ( + dom === target || + dom.contains(target) || + (dom.root && dom.root.contains(target)) + ) { return } }