iview/directives/clickoutside.js
梁灏 e355dd49d3 add Select Component
add Select Component
2016-10-22 22:27:56 +08:00

19 lines
No EOL
454 B
JavaScript

export default {
bind () {
this.documentHandler = (e) => {
if (this.el.contains(e.target)) {
return false;
}
if (this.expression) {
this.vm[this.expression]();
}
};
document.addEventListener('click', this.documentHandler);
},
update () {
},
unbind () {
document.removeEventListener('click', this.documentHandler);
}
}