antdv: Each record in table should have a unique `key` prop,or set `rowKey` to an unique primary key

阅读 63

2022-04-08

在这里插入图片描述
含义:[antdv:表中的每条记录都应该有唯一的’ key ’ prop,或者将’ rowKey '设置为唯一的主键。]

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

 <a-table
        class="mr10"
        :columns="fields"
        :dataSource="lists"
        :pagination="false"
        //加个index或者id就可
        :rowKey="lists => lists.id"  ||   :rowKey="lists => lists.index"
 >

精彩评论(0)

0 0 举报