0
点赞
收藏
分享

微信扫一扫

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

柠檬果然酸 2022-04-08 阅读 63
vue.js前端

在这里插入图片描述
含义:[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 条评论