Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

162
Vistas
Data repeating in different drop-downs : Vue.js

I have one add button, on clicking that button one dropdown should add automatically, and then if I click it again it should again add that dropdown. When one dropdown is added I chose one option from available options and then I clicked the add button again to add one more dropdown below it, the dropdown gets added but it is added with the option that I chose for the first dropdown.

Code: 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;
    },

}
}

For reference please view the attached image :

Attached image

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

It is because you are using a v-model with the same variable for all your dropdowns.

You have to use a different variable por each dropdown. According to your data model maybe SupplyChain must be an object with key->value where key is your SupplyChainArray.text and value is the variable associated to 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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda