[Vue warn]: Duplicate keys detected: x. This may cause an update error

后端 未结 6 517
我在风中等你
我在风中等你 2021-02-06 22:02

I keep getting an error when I add an item to the array which has duplicate id.

i.e.

active_widgets:Array[4]
0:Object
    id:1
    name:\"Text Blocks\"
         


        
6条回答
  •  生来不讨喜
    2021-02-06 22:34

    I solved this by creating a unique key function to add keys to each of my arrays. Then using it in v-for as the key...

    {{ user }}

    {{ post }}

    {{ dateTime }}

提交回复
热议问题