Tag Archives: Component library

Ant Design Vue-Table Error: warning.js?2149:7 [How to Solve]

When using the table of ant component library today, I encountered a problem: warning.js?2149:7 Warning: [antdv: Each record in table should have a unique `key` prop,or set `rowKey` to an unique primary key.] 。 Record it

This is because the default key value defined in columns does not have the current field in the returned data. One is to use rowkey to specify a corresponding key value pair by default, or use a subscript index similar to that in the V-for loop

Therefore, the following fields can be introduced into the table component:

:rowKey="(record,index)=>{return index}"

After introduction, it is as follows:

<a-table :columns="columns" :data-source="data" :rowKey="(record,index)=>{return index}" />

So you won’t report an error