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

请问如何重写 getMenuData方法 需要用别的路径作为根路径 #259

Open
ChinaBygones opened this issue Dec 8, 2022 · 2 comments
Labels
question Further information is requested

Comments

@ChinaBygones
Copy link

🧐 问题描述 Problem Description

请问如何重写 getMenuData方法 需要用别的路径作为根路径
我看到官方在代码里写的
routes.find((route) => route.path === "/"
我需要把这个 “/” 改成自定义的,有提供什么api或者重写吗

💻 示例代码 Sample code

const getMenuData = (routes) => {
console.log(routes);
const childrenRoute = routes.find((route) => route.path === "/");
const breadcrumb = {};
return {
menuData: formatRelativePath((childrenRoute == null ? void 0 : childrenRoute.children) || [], breadcrumb),
breadcrumb
};
};

🚑 其他信息 Other information

image

@ChinaBygones ChinaBygones added the question Further information is requested label Dec 8, 2022
@sendya
Copy link
Member

sendya commented Jan 4, 2023

@luocong2016
Copy link

getMenuData 这个方法略坑
它定义的是根节点,一般都拆分常驻路由和异步权限路由
所以这个逻辑是有问题的

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

No branches or pull requests

3 participants