<template>
  <subMenu :menuList="menuInfo.menuList" :collapse="menuInfo.collapse" :backgroundColor="menuInfo.backgroundColor"
    :textColor="menuInfo.textColor" :activeTextColor="menuInfo.activeTextColor" :defaultActive="navStore.defaultActive"
    :defaultOpeneds="menuInfo.defaultOpeneds"  :menuTrigger="menuInfo.menuTrigger"
    :router="menuInfo.router" :collapseTransition="menuInfo.collapseTransition" :popperEffect="menuInfo.popperEffect"
    :isCustomLink="menuInfo.isCustomLink" :customLinkCallBack="menuInfo.customLinkCallBack"></subMenu>
</template>
<script setup lang="ts">
import subMenu from './sideBar/subMenu.vue';
import { comNavStore } from "store/comNav"
import { permissionStore } from "store/permission"
import {list} from "router/routerData"
const navStore = comNavStore()
const permissionStoreInstance = permissionStore()
const routes = useRoute()
const router = useRouter()
const menuInfo: any = reactive({
  collapse: false,
  backgroundColor: '#fff',
  textColor: "",
  activeTextColor: '',
  defaultActive: '',
  defaultOpeneds:[],
  router: false,
  collapseTransition: true,
  menuList: list,
  isCustomLink: true,
  customLinkCallBack: (ev: any) => {
    // console.log("customLinkCallBack", ev)
    // if (ev.title.startsWith('staticDefault')) {
    //   return
    // }
    console.log("evevevevev",ev)
    router.push({
      path: ev.path
    })
    navStore.setDefaultActive(ev.path)
    navStore.addNavTarget(ev)
  }
})

onBeforeMount(() => {
  // menuInfo.defaultActive = routes.path
  console.log("routes", router.getRoutes())
  // initRouteList()
  console.log("menuInfomenuInfo",menuInfo)
  navStore.setDefaultActive(routes.path)


})


// const initRouteList = () => {
//   menuInfo.defaultActive = routes.path
//   menuInfo.defaultOpeneds.push()
// }
</script>
  
<style scoped></style>
  