Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

菜单搜索点击静态路由菜单路由跳转有bug #173

Open
gdutfls opened this issue Nov 27, 2024 · 0 comments
Open

菜单搜索点击静态路由菜单路由跳转有bug #173

gdutfls opened this issue Nov 27, 2024 · 0 comments

Comments

@gdutfls
Copy link

gdutfls commented Nov 27, 2024

function loadRoutes(routes: RouteRecordRaw[], parentPath = "") { routes.forEach((route) => { const path = route.path.startsWith("/") ? route.path : ${parentPath}/${route.path}`;
if (excludedRoutes.value.includes(route.path) || isExternal(route.path)) return;

if (route.children) {
  // 去除静态路由父级路由/导致路由出现//bug
  loadRoutes(route.children, path !== "/" ? path : "");
} else if (route.meta?.title) {
  const title = route.meta.title === "dashboard" ? "首页" : route.meta.title;
  menuItems.value.push({
    title,
    path,
    name: typeof route.name === "string" ? route.name : undefined,
    icon: route.meta.icon,
    redirect: typeof route.redirect === "string" ? route.redirect : undefined,
  });
}

});
}`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant