Commit 2fc0cb9f authored by afc163's avatar afc163

Add delay for resize

parent 17feda3a
...@@ -44,6 +44,9 @@ class BasicLayout extends React.PureComponent { ...@@ -44,6 +44,9 @@ class BasicLayout extends React.PureComponent {
type: 'user/fetchCurrent', type: 'user/fetchCurrent',
}); });
} }
componentWillUnmount() {
clearTimeout(this.resizeTimeout);
}
onCollapse = (collapsed) => { onCollapse = (collapsed) => {
this.props.dispatch({ this.props.dispatch({
type: 'global/changeLayoutCollapsed', type: 'global/changeLayoutCollapsed',
...@@ -170,9 +173,11 @@ class BasicLayout extends React.PureComponent { ...@@ -170,9 +173,11 @@ class BasicLayout extends React.PureComponent {
type: 'global/changeLayoutCollapsed', type: 'global/changeLayoutCollapsed',
payload: !collapsed, payload: !collapsed,
}); });
const event = document.createEvent('HTMLEvents'); this.resizeTimeout = setTimeout(() => {
event.initEvent('resize', true, false); const event = document.createEvent('HTMLEvents');
window.dispatchEvent(event); event.initEvent('resize', true, false);
window.dispatchEvent(event);
}, 600);
} }
handleNoticeClear = (type) => { handleNoticeClear = (type) => {
message.success(`ζΈ…η©ΊδΊ†${type}`); message.success(`ζΈ…η©ΊδΊ†${type}`);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment