Compare commits
3 Commits
9b07c7693e
...
6b56f8241d
Author | SHA1 | Date | |
---|---|---|---|
6b56f8241d | |||
d94b5d635c | |||
56c2a8ca40 |
|
@ -14,7 +14,7 @@
|
||||||
text-color="#fff"
|
text-color="#fff"
|
||||||
router
|
router
|
||||||
active-text-color="#ffd04b"
|
active-text-color="#ffd04b"
|
||||||
:default-openeds="['0', '1']"
|
:default-openeds="['0']"
|
||||||
>
|
>
|
||||||
<!-- 遍历 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;
|
||||||
|
|
|
@ -18,7 +18,6 @@ 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)
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in New Issue
Block a user