Moved mousedown event parameter in function and fixed wrongly placed parentheses

This commit is contained in:
Nicolaj Egelund 2017-03-12 17:33:12 +01:00 committed by 杨奕
parent 8034144001
commit ae32eb13aa

View File

@ -9,7 +9,7 @@ let startClick;
!Vue.prototype.$isServer && on(document, 'mousedown', e => (startClick = e));
!Vue.prototype.$isServer && on(document, 'mouseup', e => {
nodeList.forEach(node => node[ctx].documentHandler(e));
nodeList.forEach(node => node[ctx].documentHandler(e, startClick));
});
/**
* v-clickoutside
@ -22,13 +22,12 @@ let startClick;
export default {
bind(el, binding, vnode) {
const id = nodeList.push(el) - 1;
const documentHandler = function(e) {
const documentHandler = function(mouseup, mousedown) {
if (!vnode.context ||
el.contains(e.target) ||
el.contains(startClick.target) ||
el.contains(mouseup.target) ||
(vnode.context.popperElm &&
(vnode.context.popperElm.contains(e.target)) ||
vnode.context.popperElm.contains(startClick.target))) return;
(vnode.context.popperElm.contains(mouseup.target) ||
vnode.context.popperElm.contains(mousedown.target)))) return;
if (binding.expression &&
el[ctx].methodName &&