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

247
Views
Pasar datos separados a través de un evento de cambio de cuadro de selección, Vue

Tengo un cuadro de selección en funcionamiento que envía el valor seleccionado a un método en el evento de cambio, pero tengo una pregunta con esto:

Supongamos que también quiero enviar el valor cat_id en el momento de la selección (para poder crear un objeto que relacione el cat_id y la fecha dentro del método llamado) ¿hay alguna forma de enviar ese cat_id, o cualquier otro dato, junto con ese evento de cambio de cuadro de selección?

 var vm = new Vue({ el: "#app", props: { }, data: { testing_dates:['2021-11-29', '2021-11-30'], cat_id: [123] }, methods: { testChange(event){ console.log(event.target.value); }, }, });
 <script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.5.17/vue.js"></script> <div id="app"> <li>Category ID: {{ cat_id }}</li> <li style="list-style: none;"> <select style="width: auto;" @change="testChange($event)"> <option selected disabled>Options</option> <option v-for="date in testing_dates" :value="date">{{ date }}</option> </select> </li> </div>

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Puedes pasar otro parámetro:

 @change="testChange($event, cat_id)"
 testChange(event, catId){ console.log(event.target.value, catId); }

O acceda a él dentro de la función:

 testChange(event){ console.log(event.target.value, this.cat_id); }
over 4 years ago · Santiago Trujillo 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!