import { Table } from "antd";
import React from "react";
export class Tables extends React.Component {
constructor(props) {
super(props);
}
render() {
const columns = [
{
title: '姓名',
dataIndex: 'name',
align: 'center',
},
{
title: '电话',
dataIndex: 'tel',
align: 'center',
},
{
title: '地址',
dataIndex: 'address',
align: 'center',
},
{
title: '邮箱',
dataIndex: 'email',
align: 'center',
},
];
const data = [
{
key: '1',
name: 'John Brown',
tel: '10086',
address: '成都',
email: '',
},
{
key: '2',
name: 'Jim Green',
tel: '1008611',
address: '上海',
email: '',
},
{
key: '3',
name: 'Joe Black',
tel: '10001',
address: '深圳',
email: '',
},
];
return (
<Table
columns={columns}
dataSource={data}
bordered
/>
)
}
}
react 如何在table里的一列设置 url ,点击可以跳转
- 写回答
- 好问题 0 提建议
- 追加酬金
- 关注问题
- 邀请回答
-
1条回答 默认 最新
- CSDN专家-showbo 2021-09-21 14:00关注
column有render配置,返回链接对象就行,比如给name列添加链接,有帮助麻烦点个采纳【本回答右上角】,谢谢~~
{ title: '姓名', dataIndex: 'name', align: 'center', render: (text,r) => <a href={"xxx.html?id="+r.key} target="_blank">{text}</a>, }
本回答被题主选为最佳回答 , 对您是否有帮助呢?解决 1无用
悬赏问题
- ¥20 机器学习能否像多层线性模型一样处理嵌套数据
- ¥20 西门子S7-Graph,S7-300,梯形图
- ¥50 用易语言http 访问不了网页
- ¥50 safari浏览器fetch提交数据后数据丢失问题
- ¥15 matlab不知道怎么改,求解答!!
- ¥15 永磁直线电机的电流环pi调不出来
- ¥15 用stata实现聚类的代码
- ¥15 请问paddlehub能支持移动端开发吗?在Android studio上该如何部署?
- ¥20 docker里部署springboot项目,访问不到扬声器
- ¥15 netty整合springboot之后自动重连失效