Skip to content

Commit

Permalink
Modify theme scroll to top.
Browse files Browse the repository at this point in the history
  • Loading branch information
jaywcjlove committed Jul 24, 2018
1 parent a654115 commit 3fb9ef9
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions theme/default/layout/BasicLayout.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,17 @@ export default class BasicLayout extends PureComponent {
super(props);
this.state = {};
}
componentDidUpdate() {
this.scrollToTop();
}
componentDidMount() {
this.scrollToTop();
}
scrollToTop() {
document.body.scrollTop = 0;
document.documentElement.scrollTop = 0;
window.scrollTo(0, 0);
}
renderSubMenuItem(menus) {
const { location: { pathname } } = this.props;
if (menus.length > 1) {
Expand Down

0 comments on commit 3fb9ef9

Please sign in to comment.