//▼我有一个链接跳到另一个页面,并附带一个id=xxxxxxxx
<Link to="/news/newsArticle" params={{id: 12}} />
//▼这是它将来跳到的目标组件
<Route path="/news" getComponent={news}>
<IndexRoute path="/news" getComponent={newsList}/>
//▼对就在这▼
<Route path="/news/newsArticle" getComponent={newsArticle}/>
//我试过这样地址加/:id 直接不能成功跳转
//<Route path="/news/newsArticle/:id" getComponent={newsArticle}/>
</Route>
当前已经能成功跳转到目标页,但是:
▼问题是:我在目标组件打印他们,发现里面没有id,我如何能得到id
constructor(props){
super(props);
}
render() {
console.log(this.props.params)
console.log(this.props.params.id)
.....
感谢您的到来,感谢您提供的帮助。好人一生平安。
-谢谢