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

178
Views
Vue Js child to parent custom event

I'm actually struggling quite a bit about transmitting info between a child component to a parent component in a Vue-js-2 cli project.

So I have a popup modal that appears when a data is true <component v-if="profile" /> this popup contains my child component (a profile page) now how Am I supposed to be able to close this popup ? I added a little "cross icon" in it so I need on a click event to say to the parent that this.profile = false

I'm sure that I need to do it in a $emit event but don't understand how to modify a data from parent in a custom child event... thanks for any help !

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

0

There are two options to accomplish what you need:

Option 1: v-model

You can refer to v-model

<component v-model="value">

This is equivalent to (in most cases)

<component v-bind:value="data" v-on:change="data = $event">

Option 2: v-bind:value.sync

How sync modifier of v-bind achieves two-way data transmission. But in fact, these expressions are syntax sugar for event processing.

<component v-bind:value.sync="data">

equivalent to

<component v-bind:value="data" v-on:update:value="data = $event">
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!