react-ant-design 携带id进行页面跳转

1、应用场景:在表格列表中你需要跳转查看数据列表的详情,那么这个时候你就需要携带数据的id进行跳转了。
2、首先,我们使用的是react中的routerRedux进行跳转,所以在头部需要先进行引入

import { routerRedux } from 'dva/router';

3、进行跳转

  // 点击报名主题 进入报名详情页面
  handleGoToDetail = (Id) => {
    const { dispatch } = this.props;
    dispatch(
      routerRedux.push({
        pathname: `/文件名/文件名/${Id}`,
        //这里绑定了对应的id
      })
    )
  }

4、id在事件绑定相应位置进行了绑定

<a onClick={this.handleGoToDetail.bind(this, record.Id)}>{text}</a>

5、最后需要在router中的path路径进行绑定

path: '/文件名/文件名/:registrationId',

6、OK

发布了75 篇原创文章 · 获赞 16 · 访问量 1万+

猜你喜欢

转载自blog.csdn.net/weixin_45416217/article/details/103968011
今日推荐