We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
背景:后台项目需要切换路由的时候保存用户数据 就琢磨着怎么实现 antd pro项目 gitbub找了个钩子
npm install react-live-route --save-dev
找到这个文件 BasicLayout.js
{getRoutes(match.path, routerData).map(item => ( <AuthorizedRoute key={item.key} path={item.path} component={item.component} exact={item.exact} authority={item.authority} redirectPath="/exception/403" /> ))}
修改为
<ScrollToTop> {getRoutes(match.path, routerData).map((item, index) => { return (<LiveRoute path={item.path} key={index} alwaysLive={needAlwaysLive} component={item.component} />) })} </ScrollToTop>
ScrollToTop.js 切换的时候定位到顶部
import { withRouter} from 'dva/router'; import React, { Component } from 'react'; class ScrollToTop extends Component { componentDidUpdate(prevProps) { if (this.props.location !== prevProps.location) { window.scrollTo(0, 0) } } render() { return this.props.children } } export default withRouter(ScrollToTop)
#2018-12-06
The text was updated successfully, but these errors were encountered:
No branches or pull requests
背景:后台项目需要切换路由的时候保存用户数据
就琢磨着怎么实现
antd pro项目
gitbub找了个钩子
找到这个文件
BasicLayout.js
修改为
ScrollToTop.js
切换的时候定位到顶部
#2018-12-06
The text was updated successfully, but these errors were encountered: