实现table字段动态生成且可对行内数据根据不同数据类型进行编辑,效果如下:
代码如下:
dataSource: [{
'111': '21331', '222': 'sad', '333': '000', '444': 'ashdiudh' },
{
'111': '21331', '222': 'sad', '333': '000', '444': 'ashdiudh' }],
let first = [{
title: '序号',
dataIndex: 'index',
key: 'index',
width: 40,
render: (_, text, record, index) => {
return (this.state.page - 1) * this.state.size + record + 1 //根据分页生成序号
}
}]
let data = [{
//需动态获取的字段
title: '字段1',