columns = [
{
title: ‘Name‘,
dataIndex: ‘name‘,
render: (text, row, index) => {
if (index < 4) {
return <a>{text}</a>;
}
return {
children: <a>{text}</a>,
props: {
colSpan: 5,
},
};
},
},
{
title: ‘Age‘,
dataIndex: ‘age‘,
render: renderContent,
},
这样一看? index 具有很大迷惑性
应该在每行数据中插入一个属性 例如flag 当flag为true时执行某些操作
columns = [
{
title: ‘Name‘,
dataIndex: ‘name‘,
render: (text, row, index) => {
if (row.flag) {
return <a>{text}</a>;
}
return {
children: <a>{text}</a>,
props: {
colSpan: 5,
},
};
},
},
{
title: ‘Age‘,
dataIndex: ‘age‘,
render: renderContent,
},
?