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
9b3ad051
Commit
9b3ad051
authored
Aug 29, 2018
by
afc163
Committed by
εε³
Aug 30, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix menu data passing
parent
c2fe4009
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
5 deletions
+5
-5
src/layouts/BasicLayout.js
src/layouts/BasicLayout.js
+5
-5
No files found.
src/layouts/BasicLayout.js
View file @
9b3ad051
...
@@ -57,8 +57,8 @@ const menuData = formatter(routerConfig[1].routes);
...
@@ -57,8 +57,8 @@ const menuData = formatter(routerConfig[1].routes);
*/
*/
const
getBreadcrumbNameMap
=
memoizeOne
(
menu
=>
{
const
getBreadcrumbNameMap
=
memoizeOne
(
menu
=>
{
const
routerMap
=
{};
const
routerMap
=
{};
const
mergeMenuAndRouter
=
()
=>
{
const
mergeMenuAndRouter
=
data
=>
{
menuD
ata
.
forEach
(
menuItem
=>
{
d
ata
.
forEach
(
menuItem
=>
{
if
(
menuItem
.
children
)
{
if
(
menuItem
.
children
)
{
mergeMenuAndRouter
(
menuItem
.
children
);
mergeMenuAndRouter
(
menuItem
.
children
);
}
}
...
@@ -100,8 +100,7 @@ class BasicLayout extends React.PureComponent {
...
@@ -100,8 +100,7 @@ class BasicLayout extends React.PureComponent {
super
(
props
);
super
(
props
);
this
.
getPageTitle
=
memoizeOne
(
this
.
getPageTitle
);
this
.
getPageTitle
=
memoizeOne
(
this
.
getPageTitle
);
// Because there are many places to be. So put it here
// Because there are many places to be. So put it here
this
.
breadcrumbNameMap
=
getBreadcrumbNameMap
();
this
.
breadcrumbNameMap
=
getBreadcrumbNameMap
(
menuData
);
console
.
log
(
this
.
breadcrumbNameMap
);
}
}
state
=
{
state
=
{
...
@@ -133,7 +132,7 @@ class BasicLayout extends React.PureComponent {
...
@@ -133,7 +132,7 @@ class BasicLayout extends React.PureComponent {
}
}
componentDidUpdate
()
{
componentDidUpdate
()
{
this
.
breadcrumbNameMap
=
getBreadcrumbNameMap
();
this
.
breadcrumbNameMap
=
getBreadcrumbNameMap
(
menuData
);
}
}
componentWillUnmount
()
{
componentWillUnmount
()
{
...
@@ -231,6 +230,7 @@ class BasicLayout extends React.PureComponent {
...
@@ -231,6 +230,7 @@ class BasicLayout extends React.PureComponent {
Authorized
=
{
Authorized
}
Authorized
=
{
Authorized
}
theme
=
{
silderTheme
}
theme
=
{
silderTheme
}
onCollapse
=
{
this
.
handleMenuCollapse
}
onCollapse
=
{
this
.
handleMenuCollapse
}
menuData
=
{
menuData
}
{...
this
.
props
}
{...
this
.
props
}
/
>
/
>
)}
)}
...
...
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