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

160
Views
Datos que se repiten en diferentes menús desplegables: Vue.js

Tengo un botón Agregar, al hacer clic en ese botón, un menú desplegable debería agregarse automáticamente, y luego, si hago clic en él nuevamente, debería agregar ese menú desplegable nuevamente. Cuando se agrega un menú desplegable, elijo una opción de las opciones disponibles y luego hago clic en el botón Agregar nuevamente para agregar un menú desplegable más debajo, el menú desplegable se agrega pero se agrega con la opción que elegí para el primer menú desplegable.

Código: HTML:

 <div> <button class="button btn-primary" @click="addRow">Add row </button> </div> <div class="form-group row" v-for="(row,index) in addRowArr"> <div class="col-md-3"> <label>DropDown: </label> <b-input-group left="<i class='fa fa-location-arrow'></i>"> <basic-select :options="SupplyChainArray" :selected-option="SupplyChaindata" @select="SupplyChainobject" v-model="SupplyChain" name="SupplyChain" id="SupplyChain" placeholder="Select SupplyChain"> </basic-select> </b-input-group> </div> </div>

JavaScript:

 export default{ data(){ return(){ addRowArr : [], SupplyChainArray : [{value:1, text:"B2C_HEAVIES"}, {value:2, text:"second"}, {value:3, text:"third"}], SupplyChaindata: {}, SupplyChain: '', } }, methods:{ addRow(){ this.addRowArr.push({}) }, SupplyChainobject(obj) { this.SupplyChaindata = obj; this.SupplyChain = obj.value; }, } }

Para referencia, vea la imagen adjunta:

Imagen adjunta

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

0

Es porque está utilizando un v-model con la misma variable para todos sus menús desplegables.

Tienes que usar una variable diferente para cada menú desplegable. De acuerdo con su modelo de datos, quizás SupplyChain deba ser un objeto con key->value donde la clave es su SupplyChainArray.text y el valor es la variable asociada a v-model .

 <basic-select :options="SupplyChainArray" :selected-option="SupplyChaindata" @select="SupplyChainobject" v-model="row.value" name="SupplyChain" id="SupplyChain" placeholder="Select SupplyChain"> </basic-select>
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!