Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

160
Visualizações
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
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda