<script setup>
import TheItem from './Item.vue'
import MenuItem from './MenuItem.vue';

const props = defineProps({
  item: {
    type: Object,
    required: true
  }
})


</script>

<template>

  <template v-if="item.children">
    <el-sub-menu :index="'/tree/' + item.xf_id">
      <template #title>
        <TheItem :title="item.xf_name"></TheItem>
      </template>
      <MenuItem v-for="child in item.children" :item="child">
      </MenuItem>
    </el-sub-menu>
  </template>

  <template v-else>
    <el-menu-item :index="'/tree/' + item.xf_id">
      <TheItem :title="item.xf_name"></TheItem>
    </el-menu-item>
  </template>

</template>