react 页面跳转参数传值


A页面向B页面传递参数:

A页面代码如下:

事件方法toOrderDetail()

toOrderDetail(item){

  //this.props.navigation.push('跳转的目标页面', { 参数名: 参数值 })

  this.props.navigation.push('B', { order_id: item.order_id })

}

B页面接收参数代码如下:

在生命周期componentDidMount中处理

componentDidMount() {
  alert('上个页面传过来的参数:'+this.props.navigation.state.params.order_id)
  
  this.setState({
            order_id:this.props.navigation.state.params.order_id
        })
}
 
 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM