Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
ant-design-pro
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
duanledexianxianxian
ant-design-pro
Commits
91e47a40
Commit
91e47a40
authored
Aug 24, 2018
by
yoyo837
Committed by
偏右
Aug 24, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修复 #1995 中 为了就近显示title而导致面包屑在未配置菜单的子路由时重复多次
parent
eca8d34d
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
1 deletion
+9
-1
src/common/router.js
src/common/router.js
+6
-1
src/components/PageHeader/index.js
src/components/PageHeader/index.js
+3
-0
No files found.
src/common/router.js
View file @
91e47a40
...
@@ -204,7 +204,11 @@ export const getRouterData = app => {
...
@@ -204,7 +204,11 @@ export const getRouterData = app => {
Object
.
keys
(
routerConfig
).
forEach
(
path
=>
{
Object
.
keys
(
routerConfig
).
forEach
(
path
=>
{
// Regular match item name
// Regular match item name
// eg. router /user/:id === /user/chen
// eg. router /user/:id === /user/chen
const
menuKey
=
findMenuKey
(
menuData
,
path
);
let
menuKey
=
Object
.
keys
(
menuData
).
find
(
key
=>
pathToRegexp
(
path
).
test
(
`
${
key
}
`
));
const
inherited
=
menuKey
==
null
;
if
(
menuKey
==
null
)
{
menuKey
=
findMenuKey
(
menuData
,
path
);
}
let
menuItem
=
{};
let
menuItem
=
{};
// If menuKey is not empty
// If menuKey is not empty
if
(
menuKey
)
{
if
(
menuKey
)
{
...
@@ -219,6 +223,7 @@ export const getRouterData = app => {
...
@@ -219,6 +223,7 @@ export const getRouterData = app => {
name
:
router
.
name
||
menuItem
.
name
,
name
:
router
.
name
||
menuItem
.
name
,
authority
:
router
.
authority
||
menuItem
.
authority
,
authority
:
router
.
authority
||
menuItem
.
authority
,
hideInBreadcrumb
:
router
.
hideInBreadcrumb
||
menuItem
.
hideInBreadcrumb
,
hideInBreadcrumb
:
router
.
hideInBreadcrumb
||
menuItem
.
hideInBreadcrumb
,
inherited
,
};
};
routerData
[
path
]
=
router
;
routerData
[
path
]
=
router
;
});
});
...
...
src/components/PageHeader/index.js
View file @
91e47a40
...
@@ -101,6 +101,9 @@ export default class PageHeader extends PureComponent {
...
@@ -101,6 +101,9 @@ export default class PageHeader extends PureComponent {
// Loop data mosaic routing
// Loop data mosaic routing
const
extraBreadcrumbItems
=
pathSnippets
.
map
((
url
,
index
)
=>
{
const
extraBreadcrumbItems
=
pathSnippets
.
map
((
url
,
index
)
=>
{
const
currentBreadcrumb
=
getBreadcrumb
(
breadcrumbNameMap
,
url
);
const
currentBreadcrumb
=
getBreadcrumb
(
breadcrumbNameMap
,
url
);
if
(
currentBreadcrumb
.
inherited
)
{
return
null
;
}
const
isLinkable
=
index
!==
pathSnippets
.
length
-
1
&&
currentBreadcrumb
.
component
;
const
isLinkable
=
index
!==
pathSnippets
.
length
-
1
&&
currentBreadcrumb
.
component
;
return
currentBreadcrumb
.
name
&&
!
currentBreadcrumb
.
hideInBreadcrumb
?
(
return
currentBreadcrumb
.
name
&&
!
currentBreadcrumb
.
hideInBreadcrumb
?
(
<
Breadcrumb
.
Item
key
=
{
url
}
>
<
Breadcrumb
.
Item
key
=
{
url
}
>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment