forked from Gitlink/forgeplus-react
页面切换时滚动条没有返回到顶部
This commit is contained in:
parent
0566d32268
commit
1e3ce12d93
|
@ -89,7 +89,7 @@ class App extends Component {
|
|||
mygetHelmetapi: null,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
HideAddcoursestypess = (i) => {
|
||||
this.setState({
|
||||
Addcoursestype: false,
|
||||
|
@ -108,7 +108,6 @@ class App extends Component {
|
|||
document.title = "loading...";
|
||||
initAxiosInterceptors(this.props);
|
||||
this.getAppdata();
|
||||
|
||||
window.addEventListener('error', (event) => {
|
||||
const msg = `${event.type}: ${event.message}`;
|
||||
});
|
||||
|
|
|
@ -27,6 +27,14 @@ const ProjectDetail = Loadable({
|
|||
});
|
||||
|
||||
class Index extends Component {
|
||||
componentDidUpdate=(preProps)=>{
|
||||
this.props.history.listen(()=>{
|
||||
if (document.body.scrollTop || document.documentElement.scrollTop > 0) {
|
||||
window.scrollTo(0, 0);
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
render() {
|
||||
return (
|
||||
<div className="newMain clearfix">
|
||||
|
|
Loading…
Reference in New Issue