如若react-router下是:
<div className="root-router">
<Route path="/map/:type" component={MapPage} />
</div>
则在MapPage下取参数为:
const mapType = this.props.match.params.type
如若react-router下是:
<div className="root-router">
<Route path="/map/:type" component={MapPage} />
</div>
则在MapPage下取参数为:
const mapType = this.props.match.params.type
本文标题:react-router获取url上参数
本文链接:https://www.haomeiwen.com/subject/ldxspftx.html
网友评论