<template>
  <span v-if="item.type === '0'">
    <el-submenu :index="item._id || item.index" :key="item._id">
      <template slot="title">
        <i :class="['iconfont', item.icon]"></i>
        <span slot="title">{{ item.name }}</span>
      </template>
      <template v-for="ci in item.children">
        <menu-item :key="ci._id" :item="ci"></menu-item>
      </template>
    </el-submenu>
  </span>
  <span v-else>
    <el-menu-item class="first" :index="item.path" :key="item.path">
      <i :class="['iconfont', item.icon]"></i>
      <span slot="title">{{ item.name }}</span>
    </el-menu-item>
  </span>
</template>

<script>
export default {
  name: 'menu-item',
  props: { item: { type: Object, required: true } }, // 菜单设置
  components: {},
  data: function () {
    return {};
  },
  methods: {},
};
</script>

<style lang="less" scoped>
.main {
  .one {
    .iconfont {
      font-size: 18px;
      margin: 0 5px 0 0;
    }
  }
}</style>
