[Vue warn]: Duplicate keys detected: x. This may cause an update error
Same key for different v-for
loops causing this warning.you can avoid this using different key for different v-for
loops.
<div v-for="(item, i) in items" :key="i"></div>
<div v-for="(item, i) in items2" :key="'A'+ i"></div>
<div v-for="(item, i) in items3" :key="'B',+ i"></div>
//here A,B's sample characters.you can take any character in that place
An alternative method:
Nesting the v-for
elements inside any other element also seems to work.
<div>
<div v-for="(item, index) in items" :key="index"></div>
</div>
<div>
<div v-for="(item, index) in items2" :key="index"></div>
</div>