Commit d6a56da3 authored by Jeepeng's avatar Jeepeng Committed by 偏右

修复面包屑显示不正确的问题 (如`/issues/new` 会被认为`/issues/:id`) (#801)

parent 2d36097c
......@@ -9,13 +9,15 @@ import styles from './index.less';
const { TabPane } = Tabs;
function getBreadcrumb(breadcrumbNameMap, url) {
let breadcrumb = {};
Object.keys(breadcrumbNameMap).forEach((item) => {
if (pathToRegexp(item).test(url)) {
breadcrumb = breadcrumbNameMap[item];
}
});
return breadcrumb;
let breadcrumb = breadcrumbNameMap[url];
if (!breadcrumb) {
Object.keys(breadcrumbNameMap).forEach((item) => {
if (pathToRegexp(item).test(url)) {
breadcrumb = breadcrumbNameMap[item];
}
});
}
return breadcrumb || {};
}
export default class PageHeader extends PureComponent {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment