Here's the Vue component code I'm working with:
data: function () {
return {
products: [
{ product_id: '', price: ''},
{ product_id: '', price: ''},
],
}
},
I am looking for a solution to get the object index when the v-model="product_id" is changed. Is there any way to achieve this?
<div v-for="(product, key) in products">
<input type="text" v-model="product.product_id" />
<input type="text" v-model="product.price" />
</div><!-- /.div -->
Any help will be greatly appreciated. Thank you!