Blame view

src/components/menu/menu-group.vue 1.05 KB
8778b343   梁灏   init Menu components
1
  <template>
e05d7289   梁灏   update Menu
2
      <li :class="[prefixCls + '-item-group']">
3e3fba0e   zhigang.li   add style for men...
3
          <div :class="[prefixCls + '-item-group-title']" :style="groupStyle">{{ title }}</div>
e05d7289   梁灏   update Menu
4
5
          <ul><slot></slot></ul>
      </li>
8778b343   梁灏   init Menu components
6
7
  </template>
  <script>
3e3fba0e   zhigang.li   add style for men...
8
      import { findComponentUpward, findComponentsUpward } from '../../utils/assist';
e05d7289   梁灏   update Menu
9
10
      const prefixCls = 'ivu-menu';
  
8778b343   梁灏   init Menu components
11
      export default {
e05d7289   梁灏   update Menu
12
13
14
15
16
17
18
          name: 'MenuGroup',
          props: {
              title: {
                  type: String,
                  default: ''
              }
          },
8778b343   梁灏   init Menu components
19
          data () {
e05d7289   梁灏   update Menu
20
21
              return {
                  prefixCls: prefixCls
b0893113   jingsam   :art: add eslint
22
              };
3e3fba0e   zhigang.li   add style for men...
23
24
25
26
27
28
29
30
31
32
33
34
35
          },
          computed: {
              parentSubmenuNum () {
                  return findComponentsUpward(this, 'Submenu').length;
              },
              hasParentSubmenu () {
                  return findComponentUpward(this, 'Submenu');
              },
              groupStyle () {
                  return this.hasParentSubmenu ? {
                      paddingLeft: 43 + (this.parentSubmenuNum - 1) * 28 + 'px'
                  } : {};
              }
e05d7289   梁灏   update Menu
36
          }
b0893113   jingsam   :art: add eslint
37
38
      };
  </script>