You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Ant Design表格如何将数据中link字段传入render渲染按钮链接?

解决方案

Ant Design Table 的 render 函数第二个参数是当前行的完整数据对象,并非单个字段。你只需从这个对象中直接提取 link 属性即可,无需额外添加无意义的配置项。

修改后的 columns 代码如下:

const columns = [
  {
    title: "Clan name",
    dataIndex: "name",
    key: "name",
    render: (text, record) => (
      <>
        {text}
        <Button 
          type="link" 
          href={record.link} 
          icon={<InfoCircleOutlined />}
        />
      </>
    ),
  },
  // 其他列配置...
];

关键说明

  • record 是当前行对应的完整数据对象,包含你定义的 name、link、number 等所有字段,直接通过 record.link 就能获取维基文章链接。
  • 你之前添加的 address: "link" 不属于 Ant Design Table columns 的合法配置项,直接删除即可。

内容的提问来源于stack exchange,提问作者Mikhail P.

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.20 08:42:37