Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

98
Views
v-for over array and set input

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']

looks like this in console: enter image description here

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

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> 
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!