<template>
  <template v-for="(item) in props.menuList" :key="item.path">

    <el-sub-menu :index="item.name+'&&'+item.meta.title" v-if="item.children && item.children.length > 0">
      <template #title v-if="item.meta.icon">
        <el-icon>
          <Edit />
        </el-icon>
        <span>{{ item.meta.title }}</span>
      </template>
      <template #title v-else>{{ item.meta.title }}</template>
      <menuItem :menuList="(item.children as any)" />
    </el-sub-menu>
    <el-menu-item :index="item.name+'&&'+item.meta.title"  v-else  @click="handleSelectItem(item)">
      <template v-if="item.meta.icon">
        <el-icon >
          <Search/> </el-icon>
        <span>{{ item.meta.title }}</span>
      </template>
      <template  #title >
        {{ item.meta.title }}
      </template>
    </el-menu-item>
  </template>
</template>
 
   
<script lang="ts" setup>
const emits = defineEmits(['selectItem'])
const menuInfo: any = reactive({
  list: []
})

// 获取父组件传进来的子菜单列表
const props = defineProps({
  menuList: {
    type: Array,
    default: []
  },
  isCustomLink:{
    type: Boolean,
    default: false
  }
})

const handleSelectItem =(ev:any)=>{
  console.log("ev=========666",ev)
  emits("selectItem",ev)

}
</script>