From 8034144001ae0badac3525cc4139f0668b193619 Mon Sep 17 00:00:00 2001 From: Nicolaj Egelund Date: Fri, 10 Mar 2017 16:13:14 +0100 Subject: [PATCH] Added check for drag click --- src/utils/clickoutside.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/utils/clickoutside.js b/src/utils/clickoutside.js index 88f01a10..11236d2e 100644 --- a/src/utils/clickoutside.js +++ b/src/utils/clickoutside.js @@ -4,7 +4,11 @@ import { on } from 'element-ui/src/utils/dom'; const nodeList = []; 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)); }); /** @@ -21,8 +25,10 @@ export default { const documentHandler = function(e) { if (!vnode.context || el.contains(e.target) || + el.contains(startClick.target) || (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 && el[ctx].methodName &&