其他分享
首页 > 其他分享> > AntDesign of React 之 rowkey 问题

AntDesign of React 之 rowkey 问题

作者:互联网

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

const {onLoadProductListData} = this.props
    onl oadProductListData(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}}
                        />

标签:payload,attr,res,id,React,onLoadProductListData,rowkey,AntDesign,event
来源: https://www.cnblogs.com/wufenfen/p/14932343.html