This repository has been archived on 2023-08-30. You can view files and clone it, but cannot push or open issues/pull-requests.
bytedo
/
wcui
Archived
1
0
Fork 0
old
宇天 2019-08-28 21:11:17 +08:00
parent 03da3ad832
commit 00bf4f3d42
1 changed files with 11 additions and 3 deletions

View File

@ -90,9 +90,17 @@ export const unbind = function(dom, type, fn = noop, phase = false) {
export const clickOutside = function(dom, fn = noop) { export const clickOutside = function(dom, fn = noop) {
return bind(document, 'mousedown', ev => { return bind(document, 'mousedown', ev => {
if (ev) { if (ev) {
var path = ev.path.concat() if (ev.path) {
while (path.length > 3) { var path = ev.path.concat()
if (path.shift() === dom) { while (path.length > 3) {
if (path.shift() === dom) {
return
}
}
} else {
var target = ev.originalTarget || ev.target
console.log(target, typeof target, target.__proto__)
if (dom === target || dom.contains(target)) {
return return
} }
} }