时间:2020-12-10 09:37:43 | 栏目:JavaScript代码 | 点击:次
前言
本文主要给大家介绍了关于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)
总结