fix: 修复params路由传参模式下,面包屑无法找到父级路径问题

This commit is contained in:
xiaoxian521
2023-05-04 17:43:19 +08:00
parent 6176d9508b
commit d49b23e8f9
2 changed files with 14 additions and 9 deletions

View File

@@ -38,9 +38,14 @@ const getBreadcrumb = (): void => {
currentRoute = findRouteByPath(router.currentRoute.value.path, multiTags);
}
// 当前路由的父级路径组成的数组
const parentRoutes = getParentPaths(router.currentRoute.value.path, routes);
const parentRoutes = getParentPaths(
router.currentRoute.value.name as string,
routes,
"name"
);
// 存放组成面包屑的数组
let matched = [];
// 获取每个父级路径对应的路由信息
parentRoutes.forEach(path => {
if (path !== "/") matched.push(findRouteByPath(path, routes));