Estoy recorriendo un json en mi plantilla que funciona bien.
Ahora tengo una array que puede ver a continuación y quiero recorrer esta matriz y quiero ingresar el primer number en mi primer v-model b-form-input y :value , el segundo en la segunda forma b- entrada y así sucesivamente.
Entonces mi indexChild es igual al lugar del número que debe ingresarse. ( indexChild = 0 <-> place of number in my array = 0 -> Entrada: 7011412 )
¿Cómo puedo solucionar eso?
<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>mi matriz:
['7011412', '7012912', '7689012']Podría simplemente establecer el modelo v y el valor en json[indexChild]
Luego, su modelo v se establece en el valor de la matriz en el índice dado
<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>