mirror of
https://github.com/wahyd4/ant-design.git
synced 2026-08-21 02:36:28 +10:00
Fix chrome hash link
This commit is contained in:
@@ -17,10 +17,16 @@ export default class MainContent extends React.Component {
|
||||
document.body.scrollTop = 0;
|
||||
document.documentElement.scrollTop = 0;
|
||||
} else {
|
||||
location.hash = location.hash;
|
||||
this.timer = setTimeout(() => {
|
||||
document.getElementById(location.hash.replace('#', '')).scrollIntoView();
|
||||
}, 10);
|
||||
}
|
||||
}
|
||||
|
||||
componentWillUnmount() {
|
||||
clearTimeout(this.timer);
|
||||
}
|
||||
|
||||
shouldComponentUpdate(nextProps) {
|
||||
const pathname = this.props.location.pathname;
|
||||
return pathname !== nextProps.location.pathname ||
|
||||
|
||||
Reference in New Issue
Block a user