react 刷新路由的方法

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import {withRouter} from 'react-router-dom'


 //头顶部分 头像和 菜单
  const TopRightMenu = () => {
    // const history = createHashHistory()
   
    console.log(props)
    const Jump = (e) => {
      console.log(e)
      if(e.key == '111') {
        // console.log(props)
        // console.log(location)
         
        props.history.push("/test")
        // window.location.reload()
      }
    }
    const menu = (
      <Menu onClick={Jump}>
        <MenuItem key="111">管理员</MenuItem>
        <MenuItem key="222">消息</MenuItem>
        <MenuItem key="33">注销</MenuItem>
      </Menu>
    )
 
  }
  
  
//这个是高阶组件
export default withRouter(TopAdminBar)
1
2

window.location.reload()