Blame view

src/directives/clickoutside.js 556 Bytes
e355dd49   梁灏   add Select Component
1
  export default {
79288d43   梁灏   support Poptip & ...
2
3
4
      bind (el, binding, vnode) {
          function documentHandler (e) {
              if (el.contains(e.target)) {
e355dd49   梁灏   add Select Component
5
6
                  return false;
              }
79288d43   梁灏   support Poptip & ...
7
8
              if (binding.expression) {
                  binding.value(e);
e355dd49   梁灏   add Select Component
9
              }
79288d43   梁灏   support Poptip & ...
10
11
12
          }
          el.__vueClickOutside__ = documentHandler;
          document.addEventListener('click', documentHandler);
e355dd49   梁灏   add Select Component
13
14
15
16
      },
      update () {
  
      },
79288d43   梁灏   support Poptip & ...
17
18
19
      unbind (el, binding) {
          document.removeEventListener('click', el.__vueClickOutside__);
          delete el.__vueClickOutside__;
e355dd49   梁灏   add Select Component
20
      }
b0893113   jingsam   :art: add eslint
21
  };