当前位置: 移动技术网 > IT编程>开发语言>JavaScript > react-router实现跳转传值的方法示例

react-router实现跳转传值的方法示例

2018年04月29日  | 移动技术网IT编程  | 我要评论

前言

本文主要给大家介绍了关于react-router跳转传值的相关内容,分享出来供大家参考学习,下面来一起看看详细的介绍:

react-router跳转传值

1.引入包

import {hashhistory} from ‘react-router'

2.跳转传值

 handleclick = (value) => {
  hashhistory.push({
   pathname: 'message/detailmessage',
   query: {
    title:value.title,
    time:value.time,
    text:value.text
   },
  })
 }

3.接收值

console.info(this.props.location.query.title)
console.info(this.props.location.query.time)
console.info(this.props.location.query.text)

总结

以上就是这篇文章的全部内容了,希望本文的内容对大家的学习或者工作能带来一定的帮助,如果有疑问大家可以留言交流,谢谢大家对移动技术网的支持。

如对本文有疑问, 点击进行留言回复!!

相关文章:

验证码:
移动技术网