Blame view

node_modules/element-ui/packages/table/src/dropdown.js 650 Bytes
2a09d1a4   liuqimichale   添加宜春 天水 宣化
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
  import Vue from 'vue';
  var dropdowns = [];
  
  !Vue.prototype.$isServer && document.addEventListener('click', function(event) {
    dropdowns.forEach(function(dropdown) {
      var target = event.target;
      if (!dropdown || !dropdown.$el) return;
      if (target === dropdown.$el || dropdown.$el.contains(target)) {
        return;
      }
      dropdown.handleOutsideClick && dropdown.handleOutsideClick(event);
    });
  });
  
  export default {
    open(instance) {
      if (instance) {
        dropdowns.push(instance);
      }
    },
  
    close(instance) {
      var index = dropdowns.indexOf(instance);
      if (index !== -1) {
        dropdowns.splice(instance, 1);
      }
    }
  };