AntDesign of React 之 rowkey 问题

属性冲突会报错: 用父级的id拼接到子级的id上

const {onLoadProductListData} = this.props
    onLoadProductListData(1,(res)=>{
      res.payload.forEach(event=>{
        event.eventAttribute.forEach(attr=>{
          attr.id =  `${event.id}_${attr.id}`
        })
      })
      console.log(res.payload)
      this.setState({
        eventList: res.payload
      })



<Table
                          rowKey='id'
                          pagination={false}
                          columns={columns}
                          rowSelection={rowSelection}
                          dataSource={this.state.eventList}
                          childrenColumnName ="eventAttribute"
                          indentSize={20}
                          scroll={{y:this.state.tableHeight, x:1300}}
                        />
posted on 2021-06-25 19:49  取个名字真wff  阅读(807)  评论(0编辑  收藏  举报