ant design Pro 组件间通过路由(routerRedux)方式传值

1、引入  routerRedux

import { routerRedux } from 'dva/router'

2、在Table 组件中加入属性 

<Table    
   bordered
   pagination={ paginationProps }
   //双击表格行触发
   onRowDoubleClick={this.dbClick }
   columns={ this.columns }
   dataSource={ this.dataSource }
   style={{ marginTop: '10px' }}
   className="tablestyle"
   scroll={{ y: 280 }}
 />

3、定义  dbClick 方法

// 双击表格行(Row)执行
  dbClick = (record) => {
   
    const { dispatch } = this.props;
    dispatch(routerRedux.push({
      pathname:'/ltList/lzpDetail', // 这个路由为要跳转的页面(在router.config中定义)
      record: record,  // 传的值,这里的值为表格那一行的值
    }))
  };

4、在要跳转的页面中通过this.props的方式获取只

// 获取疑点列表表格行的数据
    let doubtData = {};
    doubtData = this.props.location.record !== undefined ? this.props.location.record : {};

 

props中的值 

 

 

  • 4
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值