'Set an Pseude/autogenerated :key for v-for element vue.js

i need to set a pseude/autogenerated :key for v-for elements because the ids of the items could be duplicate.

i tried this:

<my-component v-for="items in item" v-bind:key="getPseudoIds()">

...

props:{
'id' : {
  default: 0,
  type: Number,
}

...

 getPseudeIds(){
   return this.id++;
},

but i always get a

Avoid mutating a prop directly since the value will be overwritten whenever the parent component re-renders. Instead, use a data or computed property based on the prop's value. Prop being mutated: "id"

and if i declare id as data i get a infinite loop error



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source