I'm looping over a json in my template which works well.
Now I have an array which you can see down below and I want to loop over this array and want to input the first number into my first b-form-input v-model and :value, the second in the second b-form-input and so on.
So my indexChild is equal to the place of number which should be inputed. (indexChild = 0 <-> place of number in my array = 0 -> Input: 7011412)
How I'm able to solve that?
<template>
<div v-for="(item, indexChild) in json" :key="indexChild">
<div class="mt-2">Input</div>
<!-- v-for="item in array" :key="item" --> <!-- this doesn't work! -->
<b-form-input v-model="???" :value="???" type="number"></b-form-input>
</div>
</template>
my array:
['7011412', '7012912', '7689012']
You could just set the v-model and value to json[indexChild]
Then your v-model is set to the value of the array at the given index
<div v-for="(item, indexChild) in json" :key="indexChild">
<div class="mt-2">Input</div>
<!-- v-for="item in array" :key="item" --> <!-- this doesn't work! -->
<b-form-input v-model='json[indexChild]' :value="json[indexChild]" type="number"></b-form-input>
</div>