記錄目前用的比較舒服的方式:session
一、跳轉this
<Button type="secondary" size='small' > <Link to={{ pathname: '/base/strategyList',search:id+'', query: {sceneId:id,record:record} }}>查看</Link> </Button>
二、獲取值:spa
componentDidMount() { const {dispatch,location}=this.props; let recvParam; if(location.query&&location.query.record){//判斷當前有參數 recvParam=location.query.record; sessionStorage.setItem('data',recvParam);// 存入到sessionStorage中 }else{ recvParam=sessionStorage.getItem('data');// 當state沒有參數時,取sessionStorage中的參數 } this.setState({ recvParam }) console.log("recvParam",recvParam) }