具体看这篇文档
es6语法的reactjs的state状态和组件间props传递的实践
https://segmentfault.com/a/1190000009816827
React Router 页面传值的四种方法
https://blog.csdn.net/qtfying/article/details/77939171
关键代码就下面几句,结合上面的文章自己看吧。
<
Menu.Item
key=
"1"
><
Link
to=
'/home/user'
>首页
</
Link
></
Menu.Item
>
<
Route
path=
"/home/:mode"
component=
{
Console
}
/>
class
Console
extends
Component {
constructor(
props) {
super(
props);
this.
onRowClick=
this.
onRowClick.
bind(
this);
console.
log(
this.
props.
match.
params.
mode);
}
把传过来的值放在state中,通过state来控制组件的外观,如
{this.
state.
usermode?
1:
3
}.选择数据集合
也可以跟style结合起来用