setTable = (record) => {
debugger;
const { tableData } = this.state;
return (
<Table
columns={this.getTable()}
dataSource={tableData[record.id] ? tableData[record.id].list : []}
pagination={false}
/>
);
}
getDetailData = (expanded, record) => {
const { dispatch } = this.props;
const { taskId, channelId, id } = record;
dispatch({
type: 'personanalysis/getFaceTrackInfo',
payload: {
taskId,
channelId
}
}).then((res) => {
debugger;
const respon = res;
respon.list.forEach((item) => {
item.pid = record.id;
});
this.setState({
tableData: {
...this.state.tableData,
[id]: respon
}
});
});
}
{tableData[record.id] ? tableData[record.id].list : []}
id解构赋值
有问题时,分析执行顺序,代码同步异步执行"list错误时,未定义",setState()语法【id】,