React 页面间传参
1.Link state传参
import {Link} from 'react-router-dom';
<Link className={"btn_tableOp"} to={{ pathname: '/web/credit/customer/customer/informationManager/infoManagerView', state: {value: 'params-test'}}}>
查看
</Link>
componentWillMount() { console.log(this.props.location.state.value, 'value') }
方法弊端:页面刷新后无法获取参数报错;
2.session存储
3.存入路径
<Link className={"btn_tableOp"} to={`/web/credit/customer/customer/informationManager/view/${record.customerCode}/${record.tradeCode}`}>查看</Link>
路由配置
<Route path="/web/credit/customer/customer/informationManager/view/:customerCode/:tradeCode" exact component={InfoManagerView} />
获取方式
this.props.match.params.customerCode,