<template>
  <div>
    <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 :title="item.meta.title" />
          <!-- <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" :title="item.meta.title" />
        <!-- <item v-if="item.meta" :icon="item.meta && item.meta.icon" :title="item.meta.title" /> -->
      </template>
      <template v-for="child in item.children">
        <sidebar-item
          v-if="child.status"
          :key="child.name"
          :is-nest="true"
          :item="child"
          class="nest-menu"
        />
      </template>
    </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>
