<template>
  <!-- 有子集1111 -->
  <el-sub-menu v-if="props.route.children.length > 0" :index="props.route.path" :popper-offset="10"
    popper-append-to-body>
    <template #title>
      <MenuItem :meta="props.route.meta" :level="props.route.level">
      </MenuItem>
    </template>
    <!---循环渲染--->
    <SideBarItem v-for="item in props.route.children" :key="item.path" :route="item"></SideBarItem>
  </el-sub-menu>
  <!-- 没有子集 -->
  <el-menu-item v-if="props.route.children.length <= 0 && !props.route.hide" :index="props.route.path"
    @click="cahnged(props.route)">
    <MenuItem :meta="props.route.meta" :level="props.route.level">
    </MenuItem>
  </el-menu-item>

</template>

<script setup>
import MenuItem from "./MenuItem.vue";
import { defineProps, onMounted } from "vue";
import { getApi } from "@/api/tobAcco_api.js";
const props = defineProps({
  route: {
    type: Object,
    required: true
  }
});
onMounted(() => {

})
function cahnged(val) {
  getrz(val.meta.title)
}
//添加日志
function getrz(menuName) {
  getApi({ menuName, logType: '3' }, '/mosty-jcgl/miniapp/addAppLog').then(res => {
  })
}
</script>
