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

159
Views
Call methods in the parent using slots in Vue JS

I have a component called Modal. It has a slot. And I'm passing the title as a prop, And I'm passing different buttons with different methods in them using a slot. So I can reuse it anywhere.

So I'm on my homepage and I have imported my modal component with the click of the delete button on my home page the modal appears,

<Modal title="Are you sure to delete?">
   <button @click="deleteItem">Yes</button>
   <button @click="closeModal">No</button>         
</Modal>    

The deleteItem and closeModal methods on my homepage. I know when we pass slots it will call the methods in the Modal Component (according to this case). But can't we trigger this deleteItem and closeModal methods on the homepage? I just want to make my modal component reusable just the title

about 4 years ago · Juan Pablo Isaza
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!