<ul>
<li v-for="(item,index) of cards" :id='ownClass(item)' :key="index" >
</li>
</ul>
data(){
return{
cards: [{ id: 1, name: 1}, { id: 2, name: 2}]
}
}
methods:{
ownClass(item){
return `card${item.id}`
},
}
<ul>
<li v-for="(item,index) of cards" :id='ownClass(item)' :key="index" >
</li>
</ul>
data(){
return{
cards: [{ id: 1, name: 1}, { id: 2, name: 2}]
}
}
methods:{
ownClass(item){
return `card${item.id}`
},
}