Blame view

examples/routers/custem-menu-item.vue 787 Bytes
2b24fcce   zhigang.li   change the way to...
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
29
30
31
32
  <template>
    <Submenu :name="`${parentName}`">
      <template slot="title">
        <span>{{ parentItem.name }}</span>
      </template>
      <template v-for="item in children">
        <custem-menu-item v-if="item.children && item.children.length !== 0" :key="`menu-${item.name}`" :parent-item="item"></custem-menu-item>
        <menu-item v-else :name="`${item.name}`" :key="`menu-${item.name}`">{{ item.name }}</menu-item>
      </template>
    </Submenu>
  </template>
  <script>
  export default {
    name: 'custemMenuItem',
    props: {
      parentItem: {
        type: Object,
        default: () => {}
      },
      theme: String,
      iconSize: Number
    },
    computed: {
      parentName () {
        return this.parentItem.name
      },
      children () {
        return this.parentItem.children
      }
    }
  }
  </script>