Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
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
cc7212e1
You need to sign in or sign up before continuing.
Commit
cc7212e1
authored
Nov 14, 2017
by
afc163
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix dynamic component remount, #114
parent
5c6de669
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
3 deletions
+21
-3
src/layouts/BasicLayout.js
src/layouts/BasicLayout.js
+11
-2
src/layouts/UserLayout.js
src/layouts/UserLayout.js
+10
-1
No files found.
src/layouts/BasicLayout.js
View file @
cc7212e1
...
...
@@ -203,6 +203,15 @@ class BasicLayout extends React.PureComponent {
});
return
groupBy
(
newNotices
,
'
type
'
);
}
getRouteComponent
(
item
)
{
if
(
this
.
routeComponents
[
item
.
path
])
{
return
this
.
routeComponents
[
item
.
path
];
}
const
component
=
item
.
component
(
this
.
props
.
app
);
this
.
routeComponents
[
item
.
path
]
=
component
;
return
component
;
}
routeComponents
=
{};
handleOpenChange
=
(
openKeys
)
=>
{
const
lastOpenKey
=
openKeys
[
openKeys
.
length
-
1
];
const
isMainMenu
=
this
.
menus
.
some
(
...
...
@@ -239,7 +248,7 @@ class BasicLayout extends React.PureComponent {
}
}
render
()
{
const
{
app
,
currentUser
,
collapsed
,
fetchingNotices
}
=
this
.
props
;
const
{
currentUser
,
collapsed
,
fetchingNotices
}
=
this
.
props
;
const
menu
=
(
<
Menu
className
=
{
styles
.
menu
}
selectedKeys
=
{[]}
onClick
=
{
this
.
onMenuClick
}
>
...
...
@@ -352,7 +361,7 @@ class BasicLayout extends React.PureComponent {
exact
=
{
item
.
exact
}
key
=
{
item
.
path
}
path
=
{
item
.
path
}
component
=
{
item
.
component
(
app
)}
component
=
{
this
.
getRouteComponent
(
item
)}
/
>
)
)
...
...
src/layouts/UserLayout.js
View file @
cc7212e1
...
...
@@ -39,6 +39,15 @@ class UserLayout extends React.PureComponent {
});
return
title
;
}
getRouteComponent
(
item
)
{
if
(
this
.
routeComponents
[
item
.
path
])
{
return
this
.
routeComponents
[
item
.
path
];
}
const
component
=
item
.
component
(
this
.
props
.
app
);
this
.
routeComponents
[
item
.
path
]
=
component
;
return
component
;
}
routeComponents
=
{};
render
()
{
return
(
<
DocumentTitle
title
=
{
this
.
getPageTitle
()}
>
...
...
@@ -59,7 +68,7 @@ class UserLayout extends React.PureComponent {
exact
=
{
item
.
exact
}
key
=
{
item
.
path
}
path
=
{
item
.
path
}
component
=
{
item
.
component
(
this
.
props
.
app
)}
component
=
{
this
.
getRouteComponent
(
)}
/
>
)
)
...
...
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