提交 2ac046e4 authored 作者: vipcxj's avatar vipcxj

修复面包屑导航链接错误

上级 2f717e79
......@@ -36,6 +36,18 @@ class HeaderPane extends React.Component {
dispatch({ type: 'main/switchDomain', payload: keyPath[0] });
}
};
const joinPath = (paths) => {
return (paths || []).map((path) => {
let out = path;
if (out.startsWith('/')) {
out = out.substring(1);
}
if (out.endsWith('/')) {
out = out.substring(0, out.length - 1);
}
return out;
}).join('/');
};
const breadsProps = {
className: styles.breads,
routes,
......@@ -48,7 +60,7 @@ class HeaderPane extends React.Component {
return <Icon type="home" />;
}
const bread = route.name ? route.name : route.path;
return <Link to={`/${paths.join('/')}`}>{ bread }</Link>;
return <Link to={`/${joinPath(paths)}`}>{ bread }</Link>;
},
};
const menuProps = {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论