给你举个例子:
import React from "react";
import ReactDOM from "react-dom";
import "antd/dist/antd.css";
import "./index.css";
import { Table } from "antd";
const columns = [
{
title: "Name",
dataIndex: "name",
render: (text, row, index) => {
console.log(text, row);
if (index < 4) {
return <a>{text}</a>;
}
return {
children: <a>{text}</a>,
props: {
colSpan: 5
}
};
}
},
];
const data = [
{
key: "1",
name: "John Brown",
age: 32,
tel: "0571-22098909",
phone: 18889898989,
address: "New York No. 1 Lake Park"
}
];
ReactDOM.render(
<Table columns={columns} dataSource={data} bordered />,
document.getElementById("container")
);
上面代码中对应的text为John Brown;而 record为{key: "1",name: "John Brown",age: 32,tel: "0571-22098909",phone: 18889898989,address: "New York No. 1 Lake Park"}
如果你说两个一样,就得看你的代码是怎么写的了
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…