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
d4f10ee5
Commit
d4f10ee5
authored
Nov 10, 2017
by
ddcat1115
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix #128
parent
3fbfc927
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
1 deletion
+13
-1
src/layouts/BasicLayout.js
src/layouts/BasicLayout.js
+13
-1
No files found.
src/layouts/BasicLayout.js
View file @
d4f10ee5
...
@@ -55,8 +55,10 @@ class BasicLayout extends React.PureComponent {
...
@@ -55,8 +55,10 @@ class BasicLayout extends React.PureComponent {
getChildContext
()
{
getChildContext
()
{
const
{
location
}
=
this
.
props
;
const
{
location
}
=
this
.
props
;
const
routeData
=
getRouteData
(
'
BasicLayout
'
);
const
routeData
=
getRouteData
(
'
BasicLayout
'
);
const
menuData
=
getNavData
().
reduce
((
arr
,
current
)
=>
arr
.
concat
(
current
.
children
),
[]);
const
firstMenuData
=
getNavData
().
reduce
((
arr
,
current
)
=>
arr
.
concat
(
current
.
children
),
[]);
const
menuData
=
this
.
getMenuData
(
firstMenuData
,
''
);
const
breadcrumbNameMap
=
{};
const
breadcrumbNameMap
=
{};
routeData
.
concat
(
menuData
).
forEach
((
item
)
=>
{
routeData
.
concat
(
menuData
).
forEach
((
item
)
=>
{
breadcrumbNameMap
[
item
.
path
]
=
item
.
name
;
breadcrumbNameMap
[
item
.
path
]
=
item
.
name
;
});
});
...
@@ -83,6 +85,16 @@ class BasicLayout extends React.PureComponent {
...
@@ -83,6 +85,16 @@ class BasicLayout extends React.PureComponent {
});
});
}
}
}
}
getMenuData
=
(
data
,
parentPath
)
=>
{
let
arr
=
[];
data
.
forEach
((
item
)
=>
{
if
(
item
.
children
)
{
arr
.
push
({
path
:
`
${
parentPath
}
/
${
item
.
path
}
`
,
name
:
item
.
name
});
arr
=
arr
.
concat
(
this
.
getMenuData
(
item
.
children
,
`
${
parentPath
}
/
${
item
.
path
}
`
));
}
});
return
arr
;
}
getDefaultCollapsedSubMenus
(
props
)
{
getDefaultCollapsedSubMenus
(
props
)
{
const
currentMenuSelectedKeys
=
[...
this
.
getCurrentMenuSelectedKeys
(
props
)];
const
currentMenuSelectedKeys
=
[...
this
.
getCurrentMenuSelectedKeys
(
props
)];
currentMenuSelectedKeys
.
splice
(
-
1
,
1
);
currentMenuSelectedKeys
.
splice
(
-
1
,
1
);
...
...
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