react-router-dom路由跳转

Posted on 2019-07-10 15:36  勤勤恳恳大猿人  阅读(2623)  评论(0编辑  收藏  举报
1.使用query传递  
   this.props.history.push({ pathname : '/access_control/role/roleEdit',query:{ aa: 'aa'} })
 获取参数:
   this.props.location.query.aa
2.使用state传递
 this.props.history.push({ pathname : '/access_control/role/roleEdit',state:{ aa: 'aa'} })
 获取参数:
   this.props.location.state.aa
 
 
  state传的参数是加密的,query传的参数是公开的,在地址栏