Fix unexpected scrollTop change

This commit is contained in:
afc163 2017-12-11 20:34:11 +08:00
parent d1568c959c
commit 3e0df406f1

View File

@ -75,7 +75,7 @@ export default class MainContent extends React.Component {
if (!nextProps || nextProps.location.pathname !== this.props.location.pathname) { if (!nextProps || nextProps.location.pathname !== this.props.location.pathname) {
this.bindScroller(); this.bindScroller();
} }
if (!window.location.hash) { if (!window.location.hash && nextProps && nextProps.location.pathname !== this.props.location.pathname) {
document.body.scrollTop = 0; document.body.scrollTop = 0;
document.documentElement.scrollTop = 0; document.documentElement.scrollTop = 0;
return; return;