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
18c1ac60
Commit
18c1ac60
authored
Feb 03, 2019
by
Mike
Committed by
ιεΈ
Feb 04, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: unresponsive collapse btn on mobile (#3504)
parent
0b3ec67a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
11 deletions
+12
-11
src/components/SiderMenu/SiderMenu.js
src/components/SiderMenu/SiderMenu.js
+12
-2
src/layouts/BasicLayout.js
src/layouts/BasicLayout.js
+0
-9
No files found.
src/components/SiderMenu/SiderMenu.js
View file @
18c1ac60
...
@@ -9,6 +9,8 @@ import { getDefaultCollapsedSubMenus } from './SiderMenuUtils';
...
@@ -9,6 +9,8 @@ import { getDefaultCollapsedSubMenus } from './SiderMenuUtils';
const
BaseMenu
=
React
.
lazy
(()
=>
import
(
'
./BaseMenu
'
));
const
BaseMenu
=
React
.
lazy
(()
=>
import
(
'
./BaseMenu
'
));
const
{
Sider
}
=
Layout
;
const
{
Sider
}
=
Layout
;
let
firstMount
=
true
;
export
default
class
SiderMenu
extends
PureComponent
{
export
default
class
SiderMenu
extends
PureComponent
{
constructor
(
props
)
{
constructor
(
props
)
{
super
(
props
);
super
(
props
);
...
@@ -17,6 +19,10 @@ export default class SiderMenu extends PureComponent {
...
@@ -17,6 +19,10 @@ export default class SiderMenu extends PureComponent {
};
};
}
}
componentDidMount
()
{
firstMount
=
false
;
}
static
getDerivedStateFromProps
(
props
,
state
)
{
static
getDerivedStateFromProps
(
props
,
state
)
{
const
{
pathname
,
flatMenuKeysLen
}
=
state
;
const
{
pathname
,
flatMenuKeysLen
}
=
state
;
if
(
if
(
...
@@ -50,7 +56,7 @@ export default class SiderMenu extends PureComponent {
...
@@ -50,7 +56,7 @@ export default class SiderMenu extends PureComponent {
};
};
render
()
{
render
()
{
const
{
logo
,
collapsed
,
onCollapse
,
fixSiderbar
,
theme
}
=
this
.
props
;
const
{
logo
,
collapsed
,
onCollapse
,
fixSiderbar
,
theme
,
isMobile
}
=
this
.
props
;
const
{
openKeys
}
=
this
.
state
;
const
{
openKeys
}
=
this
.
state
;
const
defaultProps
=
collapsed
?
{}
:
{
openKeys
};
const
defaultProps
=
collapsed
?
{}
:
{
openKeys
};
...
@@ -64,7 +70,11 @@ export default class SiderMenu extends PureComponent {
...
@@ -64,7 +70,11 @@ export default class SiderMenu extends PureComponent {
collapsible
collapsible
collapsed
=
{
collapsed
}
collapsed
=
{
collapsed
}
breakpoint
=
"
lg
"
breakpoint
=
"
lg
"
onCollapse
=
{
onCollapse
}
onCollapse
=
{(
collapse
)
=>
{
if
(
firstMount
||
!
isMobile
)
{
onCollapse
(
collapse
);
}
}}
width
=
{
256
}
width
=
{
256
}
theme
=
{
theme
}
theme
=
{
theme
}
className
=
{
siderClassName
}
className
=
{
siderClassName
}
...
...
src/layouts/BasicLayout.js
View file @
18c1ac60
...
@@ -75,15 +75,6 @@ class BasicLayout extends React.Component {
...
@@ -75,15 +75,6 @@ class BasicLayout extends React.Component {
});
});
}
}
componentDidUpdate
(
preProps
)
{
// After changing to phone mode,
// if collapsed is true, you need to click twice to display
const
{
collapsed
,
isMobile
}
=
this
.
props
;
if
(
isMobile
&&
!
preProps
.
isMobile
&&
!
collapsed
)
{
this
.
handleMenuCollapse
(
false
);
}
}
getContext
()
{
getContext
()
{
const
{
location
,
breadcrumbNameMap
}
=
this
.
props
;
const
{
location
,
breadcrumbNameMap
}
=
this
.
props
;
return
{
return
{
...
...
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