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'; ...@@ -9,13 +9,15 @@ import styles from './index.less';
const { TabPane } = Tabs; const { TabPane } = Tabs;
function getBreadcrumb(breadcrumbNameMap, url) { function getBreadcrumb(breadcrumbNameMap, url) {
let breadcrumb = {}; let breadcrumb = breadcrumbNameMap[url];
if (!breadcrumb) {
Object.keys(breadcrumbNameMap).forEach((item) => { Object.keys(breadcrumbNameMap).forEach((item) => {
if (pathToRegexp(item).test(url)) { if (pathToRegexp(item).test(url)) {
breadcrumb = breadcrumbNameMap[item]; breadcrumb = breadcrumbNameMap[item];
} }
}); });
return breadcrumb; }
return breadcrumb || {};
} }
export default class PageHeader extends PureComponent { 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