diff --git a/src/components/comNav/index.vue b/src/components/comNav/index.vue index 537d023..fcc6acc 100644 --- a/src/components/comNav/index.vue +++ b/src/components/comNav/index.vue @@ -1,8 +1,7 @@ @@ -20,56 +19,41 @@ const menuInfo: any = reactive({ backgroundColor: '#fff', textColor: "", activeTextColor: '', - defaultActive: "", - defaultOpeneds: ['staticDefault_PathParent&&配置管理'], + 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("customLinkCallBack", ev) + // if (ev.title.startsWith('staticDefault')) { + // return + // } + console.log("evevevevev",ev) router.push({ - name: ev.path + path: ev.path }) navStore.setDefaultActive(ev) navStore.addNavTarget(ev) } }) -onMounted(() => { +onBeforeMount(() => { + menuInfo.defaultActive = routes.path console.log("routes", router.getRoutes()) - initRouteList() - + // initRouteList() + console.log("menuInfomenuInfo",menuInfo) + navStore.setDefaultActive(routes.path) }) -const initRouteList = () => { - // const routeList = router.getRoutes() - // menuInfo.menuList = routeList.find(ele=>ele.meta.routeListRoot)?.children - // menuInfo.defaultOpeneds = menuInfo.menuList[0].path - // console.log("menuInfo.menuList",menuInfo.menuList) - menuInfo.defaultOpeneds.push() - const routes: any = list - console.log("routes", router) - const currentNav = routes.find((ele:any)=>ele.meta.folder).children[0] - // if (navStore.topNavList.length == 0) { - // let firstNav = { - // title: currentNav.meta.title, - // name: currentNav.name, - // path: currentNav.path - // } - // navStore.addNavTarget(firstNav) - // navStore.setCurrentNav(currentNav.path) - // } - console.log("currentNav", currentNav) - menuInfo.defaultActive = currentNav.name + '&&' + currentNav.meta.title - console.log("currentNav", menuInfo.defaultActive) -} +// const initRouteList = () => { +// menuInfo.defaultActive = routes.path +// menuInfo.defaultOpeneds.push() +// } diff --git a/src/components/comNav/sideBar/menuItem.vue b/src/components/comNav/sideBar/menuItem.vue index 2e36308..65a0048 100644 --- a/src/components/comNav/sideBar/menuItem.vue +++ b/src/components/comNav/sideBar/menuItem.vue @@ -1,7 +1,7 @@