Blame view

src/directives/clickoutside.js 454 Bytes
e355dd49   梁灏   add Select Component
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
  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);
      }
  }