ant desgin pro 跨页面传参

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/qq_25252769/article/details/79958487

1、routerRedux方式

import { routerRedux } from 'dva/router';

goOrder (record){//页面跳转+参数
    this.props.dispatch(routerRedux.push({ 
      pathname: '/giveData/queryOrder',
      params: record.userId
    }))
  }

<a className={styles.oprLink} onClick={()=>this.goOrder(record)}>查订单</a>

使用this.props.location.params接收值

2、link方式

import { Link } from 'react-router-dom';
或者
import { Link } from 'dva/router';

<Link to={{pathname:'/user',query:id}}>添加用户</Link>

使用v2,v3this.props.location.query或者v4的this.props.location.search接收值

猜你喜欢

转载自blog.csdn.net/qq_25252769/article/details/79958487
今日推荐