In Vue, I have a v-for loop that renders an input according to an object I have. The input is with a v-model to a computed function:
<template v-for="product in products>"
{{ product.Name }}: <input type="text" v-model="productAmount">
</template>
and accordingly, the computed function with get and setter:
computed: {
productAmount: {
get () {
this.product.DefaultAmount
},
set (newAmount) {
// doing something
}
}
}
The problem is that this.product
in get()
is undefined.
Is there a way to refer to a dynamic variable of v-for inside the getter of the computed function?