Compare commits

..

No commits in common. "6b56f8241d6a02f4fd4fac306b78f60f86ac514a" and "9b07c7693eae00c8324833d473b345266bd5177a" have entirely different histories.

2 changed files with 5 additions and 4 deletions

View File

@ -14,7 +14,7 @@
text-color="#fff" text-color="#fff"
router router
active-text-color="#ffd04b" active-text-color="#ffd04b"
:default-openeds="['0']" :default-openeds="['0', '1']"
> >
<!-- 遍历 menuRoutes动态渲染菜单项 --> <!-- 遍历 menuRoutes动态渲染菜单项 -->
<template v-for="(item, index) in menuRoutes"> <template v-for="(item, index) in menuRoutes">
@ -153,16 +153,16 @@ const menuRoutes = computed(() => {
// layout // layout
const adjustedRoutes = routes.flatMap((route) => { const adjustedRoutes = routes.flatMap((route) => {
// 'layout' // 'layout'
if (route.path === '/' && route.children) { if (route.path === "/" && route.children) {
return route.children.map((child) => ({ return route.children.map((child) => ({
...child, ...child,
path: child.path, path: child.path,
meta: child.meta, meta: child.meta,
})); }));
} }
console.log('map-->',route);
// //
if (route.meta?.hidden) { if (route.meta?.hidden) {
console.log('11',route.children);
return []; return [];
} }
return route; return route;

View File

@ -18,6 +18,7 @@ import { ArrowRight } from '@element-plus/icons-vue'
import { computed } from 'vue'; import { computed } from 'vue';
import { useRouter } from 'vue-router'; import { useRouter } from 'vue-router';
const router = useRouter() const router = useRouter()
console.log('当前路由--->', router.currentRoute.value.matched)
const routers = computed(() => { //meta const routers = computed(() => { //meta
return router.currentRoute.value.matched.filter(item => item.meta.title) return router.currentRoute.value.matched.filter(item => item.meta.title)
}) })