react-router跳转传值

来源:互联网 发布:网络言情小说家排名 编辑:程序博客网 时间:2024/06/06 18:20

1.引入包 

import {hashHistory} from ‘React-router’

2.跳转传值

    handleClick = (value) => {        hashHistory.push({            pathname: 'message/detailMessage',            query: {                title:value.title,                time:value.time,                text:value.text            },        })    }
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10

3.接收值

console.info(this.props.location.query.title)console.info(this.props.location.query.time)console.info(this.props.location.query.text)
0 0
原创粉丝点击