[Vuejs]-Can I get data in object from double v-for

4👍

If I understand you correctly, you can do it this way:

<tr v-for="product in allPosts" :key="product.id">
    <td v-for='(item, i) in checked' :key='`item${i}`'>{{product[item]}}</td>
</tr>

Notice the square brackets around item. This allows you to dynamically select the name of a property in the product object using the contents of the item variable.

Leave a comment