withRouter是高阶组件,可以通过 withRouter 获取到 history、location、match 对象。
            
            
              js
              
              
            
          
          import { withRouter } from 'umi';
export default withRouter(({ history, location, match }) => {
  return (
    <div>
      <ul>
        <li>history: {history.action}</li>
        <li>location: {location.pathname}</li>
        <li>match: {`${match.isExact}`}</li>
      </ul>
    </div>
  );
});