Browse Source

Fix scroll

pull/8729/head
Wei Zhu 7 years ago
parent
commit
7cb5b48746
  1. 6
      site/theme/template/Content/MainContent.jsx

6
site/theme/template/Content/MainContent.jsx

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

Loading…
Cancel
Save