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,
}); });
this.resizeTimeout = setTimeout(() => {
const event = document.createEvent('HTMLEvents'); const event = document.createEvent('HTMLEvents');
event.initEvent('resize', true, false); event.initEvent('resize', true, false);
window.dispatchEvent(event); 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