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

一级路由 children 判断有问题 #2

Open
minisailboat opened this issue Apr 13, 2024 · 1 comment
Open

一级路由 children 判断有问题 #2

minisailboat opened this issue Apr 13, 2024 · 1 comment

Comments

@minisailboat
Copy link

@xia5800
一级路由没有子路由但是 children 存在的时候会出问题

// 用户菜单转换成vue-router的路由,并添加到vue-router中
menuToRoute(menus as UserMenu[]).forEach((route) => {
  // 如果route是一级路由且没有子路由。添加到/路由下
  // if (!route.children) {
  if (!route.children || route.children.length === 0) {
    rootRouter.children = rootRouter.children.concat(route);
    router.addRoute(rootRouter);
  } else {
    router.addRoute(route);
  }
});
@xia5800
Copy link
Owner

xia5800 commented Apr 22, 2024

很抱歉回复晚了,github不经常上,感谢您提供的代码。

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

2 participants