Commit 80341440 authored by Nicolaj Egelund's avatar Nicolaj Egelund Committed by 杨奕

Added check for drag click

parent 1e689a22
...@@ -4,7 +4,11 @@ import { on } from 'element-ui/src/utils/dom'; ...@@ -4,7 +4,11 @@ import { on } from 'element-ui/src/utils/dom';
const nodeList = []; const nodeList = [];
const ctx = '@@clickoutsideContext'; const ctx = '@@clickoutsideContext';
!Vue.prototype.$isServer && on(document, 'click', e => { 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));
}); });
/** /**
...@@ -21,8 +25,10 @@ export default { ...@@ -21,8 +25,10 @@ export default {
const documentHandler = function(e) { const documentHandler = function(e) {
if (!vnode.context || if (!vnode.context ||
el.contains(e.target) || el.contains(e.target) ||
el.contains(startClick.target) ||
(vnode.context.popperElm && (vnode.context.popperElm &&
vnode.context.popperElm.contains(e.target))) return; (vnode.context.popperElm.contains(e.target)) ||
vnode.context.popperElm.contains(startClick.target))) return;
if (binding.expression && if (binding.expression &&
el[ctx].methodName && el[ctx].methodName &&
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment