关于antD中warning.js?2149:7 Warning: [antdv: Each record in table should have a unique `key` prop,or set `rowKey` to an unique primary key.]

含义:[antdv:表中的每条记录都应该有唯一的' key ' prop,或者将' rowKey '设置为唯一的主键。]

一般这种情况的消除就直接用表格的每一行的单独的主键id就行了(后台返回值一般这种列表都会返回主键唯一id,不行的话就用index数组下标也不会重复

<a-table bordered :data-source="dataSource" :columns="columns" :pagination="pagination" :rowKey="record=>record.id">
            <template slot="handle" slot-scope="text,recode">
                <a @click="showInformation(recode)">详情</a>
                <a-divider type="vertical" />
                <a @click="operation(recode)">编辑</a>
            </template>
        </a-table>

 

差不多就这样

 

相关文章:

  • 2021-04-08
  • 2021-09-29
  • 2021-07-31
  • 2021-11-22
  • 2021-08-17
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-10-22
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-06-23
相关资源
相似解决方案