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

154
Views
Vuejs Passing Data from child to parent

Need some help. I have a component

<BasicFilter></BasicFilter>

with a select

<select @change="$emit('onSortName', $event)">
<option value="asc"> A..Z</option><option value="desc"></select>

and want to pass the selected value to a function in parent:

onSortName(event) {
  if (event.target.value == 'desc') {
    do something
  }
}

How to pass the event.target.value to the function in the parent?

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

0

In child you emit event with data you want to send to parent:

<select @change="$emit('onSortName', data)">

in parent template you listen to event:

<BasicFilter @onSortName="onSortName"></BasicFilter>

method to do something on event from child

methods: {
  onSortName(val) {
    if (val == 'desc') {
      //do something
    }
  }
}
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!