react---带参数跳转

来源:互联网 发布:淘宝店铺定位有哪些 编辑:程序博客网 时间:2024/06/06 19:39
第一页面<Link to={`/work_order/order_detail/${record.id}`}>{record.id}</Link>目标页面1、导出组件中     constructor (props) {        super(props);        this.state = {            detailId: props.match.params.id        }        console.log(props.match.params.id)    }    render(){        return (            <div>                <NewOrderForm id={this.state.detailId} />                            </div>        )    } 2、用到该数据的组件  componentDidMount(){        console.log(this.props.id);  }
原创粉丝点击