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

100
Views
pasar valor a múltiples funciones

Tengo un v-for en un v-for . Después de hacer clic en mi dropdown-item seleccionado, paso mis datos a mis methods ; esto funciona bien, por supuesto.

Pero ahora necesito el itemDropdown.ID exacto en otra función en mis métodos...

¿Tengo que pasar datos de un método a otro o cómo puedo resolver eso?

¡Gracias!

 <div v-for="(item, index) in json" :key="index"> <b-dropdown text="Selection" right> <b-dropdown-item v-for="(itemDropdown, indexDropdown) in json2" :key="indexDropdown" @click="inputDropdown(itemDropdown.ID)">{{itemDropdown.Name}}</b-dropdown-item> </b-dropdown> </div>
 methods: { inputDropdown(ID) { //Some code }, anotherFunction(here I need this itemDropdown.ID as well!) //Do some code too } }
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Creo que sería mejor escribir algún método de controlador como ese y también puede extender el uso con otros métodos.

 <div v-for="(item, index) in json" :key="index"> <b-dropdown text="Selection" right> <b-dropdown-item v-for="(itemDropdown, indexDropdown) in json2" :key="indexDropdown" @click="dropdownClickHandler(itemDropdown.ID)">{{itemDropdown.Name}}</b-dropdown-item> </b-dropdown> </div>

Creo que sería más legible en un uso como ese.

 methods: { dropdownClickHandler(ID) { this.inputDropdown(ID); this.anotherFunction(ID); }, inputDropdown(ID) { //Some code }, anotherFunction(ID) // Some code } }
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!