ant design pro 跨頁面傳參

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,v3的 this.props.location.query或者v4的this.props.location.search接收值。


原文:https://blog.csdn.net/qq_25252769/article/details/79958487 

其他參考方法:ant design列表頁帶參數跳轉到詳情頁
 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章