Blame view

src/components/select/option-group.vue 1.31 KB
e355dd49   梁灏   add Select Component
1
  <template>
f5ecd167   梁灏   fixed #186
2
      <li :class="[prefixCls + '-wrap']" v-show="!hidden">
d6342fe1   jingsam   fixed ie bug
3
          <div :class="[prefixCls + '-title']">{{ label }}</div>
e355dd49   梁灏   add Select Component
4
          <ul>
f5ecd167   梁灏   fixed #186
5
              <li :class="[prefixCls]" v-el:options><slot></slot></li>
e355dd49   梁灏   add Select Component
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
          </ul>
      </li>
  </template>
  <script>
      const prefixCls = 'ivu-select-group';
  
      export default {
          props: {
              label: {
                  type: String,
                  default: ''
              }
          },
          data () {
              return {
f5ecd167   梁灏   fixed #186
21
22
                  prefixCls: prefixCls,
                  hidden: false    // for search
b0893113   jingsam   :art: add eslint
23
              };
f5ecd167   梁灏   fixed #186
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
          },
          methods: {
              queryChange () {
                  this.$nextTick(() => {
                      const options = this.$els.options.querySelectorAll('.ivu-select-item');
                      let hasVisibleOption = false;
                      for (let i = 0; i < options.length; i++) {
                          if (options[i].style.display !== 'none') {
                              hasVisibleOption = true;
                              break;
                          }
                      }
                      this.hidden = !hasVisibleOption;
                  });
              }
          },
          events: {
              'on-query-change' () {
                  this.queryChange();
                  return true;
              }
e355dd49   梁灏   add Select Component
45
          }
b0893113   jingsam   :art: add eslint
46
      };
d6342fe1   jingsam   fixed ie bug
47
  </script>