Answer the question
In order to leave comments, you need to log in
Is it possible to add new properties to array elements in v-for?
The question is. An array with comments comes from the server. I iterate through it with v-for and render the elements. Suppose we have the following set:
arr: [
{ name: 'John', age: 13 },
{ name: 'Johny', age: 14 },
{ name: 'Johnathan', age: 15 },
]
<ul>
<template v-for="(item, index) in arr">
<li :key="index">{{ item.name }} {{ item.age }}</li>
</template>
</ul>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question