<template>
  <div v-if="item.status">
    <template v-if="!item.children || !item.children.length">
      <app-link v-if="item.meta" :to="item.path">
        <el-menu-item :index="item.path" :class="{ 'submenu-title-noDropdown': !isNest }">
          <item :icon="item.meta.icon || (item.meta && item.meta.icon)" :title="item.meta.title" />
        </el-menu-item>
      </app-link>
    </template>
    <el-submenu v-else ref="subMenu" :index="item.path" popper-append-to-body>
      <template slot="title">
        <item v-if="item.meta" :icon="item.meta && item.meta.icon" :title="item.meta.title" />
      </template>
      <sidebar-item v-for="child in item.children" :key="child.name" :is-nest="true" :item="child" class="nest-menu" />
    </el-submenu>
  </div>
</template>

<script>
import Item from './Item'
import AppLink from './Link'
import FixiOSBug from './FixiOSBug'

export default {
  name: 'SidebarItem',
  components: { Item, AppLink },
  mixins: [FixiOSBug],
  props: {
    item: {
      type: Object,
      required: true
    },
    isNest: {
      type: Boolean,
      default: false
    }
  },
  data() {
    return {}
  },
  methods: {}
}
</script>
