<template>
  <div>
    <template v-for="(item, index) in subMenuList">
      <el-submenu
        v-if="item.children && item.children.length > 0"
        :key="item.path + '_' + index"
				:index="item.path + '_' + index"
      >
        <template slot="title">
          <!-- <i :class="item.icon"></i> -->
          <img :src="item.icon" alt="">
          <span>{{ item.name }}</span>
        </template>
        <SubMenu :subMenuList="item.children" />
      </el-submenu>
      <el-menu-item v-else :key="item.path" :index="item.path">
        <template slot="title">
          <i :class="item.icon"></i>
          <span>{{ item.name }}</span>
        </template>
      </el-menu-item>
    </template>
  </div>
</template>

<script>
import SubMenu from "./SubMenu.vue";

export default {
	name: "SubMenu",
  components: { SubMenu },
  props: ['subMenuList'],
};
</script>

<style>
.el-menu--collapse>div>.el-menu-item span,
.el-menu--collapse>div>.el-submenu>.el-submenu__title span {
    height: 0;
    width: 0;
    overflow: hidden;
    visibility: hidden;
    display: inline-block;
}
</style>
