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

166
Views
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 answers
Answer question

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 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!