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

路由怎么配置跳转外链,就是path配置了http链接 #10894

Closed
baiwumm opened this issue Aug 17, 2023 · 1 comment
Closed

路由怎么配置跳转外链,就是path配置了http链接 #10894

baiwumm opened this issue Aug 17, 2023 · 1 comment

Comments

@baiwumm
Copy link

baiwumm commented Aug 17, 2023

🧐 问题描述 | Problem description

image
image

这样配置路由,点击跳转直接404,请问我该如何处理

我尝试在BasiLayout的onPageChange处理,但没进入到这里

💻 示例代码 | Sample code

🚑 其他信息 | Other information

OS:

Node:

浏览器 | browser:

@ZhuYuRan001
Copy link

我是这样配置的,app.tsx中//自定义菜单渲染,layout配置属性
menuItemRender(menuItemProps: any, defaultDom: any, props) {
//判断path是否为外部链接,如果为外部链接,则返回a标签
if (menuItemProps.isUrl || menuItemProps.children) {
return <a href={menuItemProps.path.replace('/', '')}>{defaultDom};
}
//如果为项目内路由,则返回Link组件
if (menuItemProps.path && location.pathname !== menuItemProps.path) {
return (
// handle wildcard route path, for example /slave/
from qiankun
<Link to={menuItemProps.path.replace('/*', '')} target={menuItemProps.target}>
{defaultDom}

);
}
return defaultDom;
},

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

3 participants