ClickOutside: fix 'Cannot read property target of undefined'

pull/5439/head
Leopoldthecoder 2017-06-15 18:31:11 +08:00 committed by 杨奕
parent 8675c31e36
commit 45628ecbf3
4 changed files with 6 additions and 4 deletions

View File

@ -22,8 +22,10 @@ let startClick;
export default {
bind(el, binding, vnode) {
const id = nodeList.push(el) - 1;
const documentHandler = function(mouseup, mousedown) {
const documentHandler = function(mouseup = {}, mousedown = {}) {
if (!vnode.context ||
!mouseup.target ||
!mousedown.target ||
el.contains(mouseup.target) ||
(vnode.context.popperElm &&
(vnode.context.popperElm.contains(mouseup.target) ||

View File

@ -146,7 +146,7 @@ describe('Dropdown', () => {
done();
}, 300);
}, 300);
});
}).timeout(3000);
it('hide on click', done => {
vm = createVue({
template: `

View File

@ -357,7 +357,7 @@ describe('Form', () => {
}, 100);
}, 100);
});
});
}).timeout(3000);
it('datepicker', done => {
vm = createVue({
template: `

View File

@ -293,7 +293,7 @@ describe('Menu', () => {
done();
}, 1000);
}, 500);
});
}).timeout(3000);
it('menu trigger click', done => {
vm = createVue({
template: `