add file
Some old users use this file, so add agin
This commit is contained in:
parent
93ea90c509
commit
4bcfa1d5de
1 changed files with 21 additions and 0 deletions
21
src/directives/clickoutside.js
Normal file
21
src/directives/clickoutside.js
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
export default {
|
||||||
|
bind (el, binding, vnode) {
|
||||||
|
function documentHandler (e) {
|
||||||
|
if (el.contains(e.target)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (binding.expression) {
|
||||||
|
binding.value(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
el.__vueClickOutside__ = documentHandler;
|
||||||
|
document.addEventListener('click', documentHandler);
|
||||||
|
},
|
||||||
|
update () {
|
||||||
|
|
||||||
|
},
|
||||||
|
unbind (el, binding) {
|
||||||
|
document.removeEventListener('click', el.__vueClickOutside__);
|
||||||
|
delete el.__vueClickOutside__;
|
||||||
|
}
|
||||||
|
};
|
Loading…
Add table
Reference in a new issue