react页面传参跳转Link&hashHistory

第一种方式使用link:

<Link to={{ pathname: 'purchaseRecord', type: 'inputs', id: '1'}} ><a onClick={()=>this.handleRecord()}>拼团记录</a></Link>

获取传过来的值:this.props.location.type/id

第二种使用hashHistory:

hashHistory.push({

pathname: 'activity/purchaseRecord',

query: {

id: '1',

}

});

获取传过来的值:this.props.location.query.id

猜你喜欢

转载自blog.csdn.net/Alison_Z/article/details/81450605