If you are working with Vuejs, it is important to structure your data properly in the return statement:
<script>
export default {
data() {
return {
items: [{ message: 'Foo' }, { message: 'Bar' }]
}
}
}
</script>
You can then use a v-for loop to iterate over the items:
<template>
<div v-for="(item, index) in items">
<input :id="index" v-model="item.message" />
</div>
</template>
For a more specific case, such as when using props like altinFiyati, you would set it up like this:
<script>
export default {
props: {
altinFiyati: Object
},
data() {
return {
altinCount: this.altinFiyati,
}
}
}
</script>
Then in the v-for loop, you can connect your data to the v-model input:
<template>
<div v-for="(item, index) in altinCount">
<input :id="index" v-model="item.message" />
</div>
</template>