Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

315
Vistas
Vue: Get method from component that is in scoped slot

Component Page:

...
<Child>
  <template #form="{ init }">
    <PageForm :init="init"/>
...

Component PageForm:

...
methods: {
  getData() {
    // i need to call in component-grandchild of Page-component
  }
}
...

Component Child (render-function):

...
h('GrandChild', {scopedSlots: {form = props => h('div', this.$scopedSlots.form(props)}}
...

Component GrandChild:

template:

...
<div>
  <slot name="form" :init="init">
<div>
...

script:

...
mounted: {
  // how here get method getData from Page->PageForm without Vuex?
}
...
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

I understand that if the structure of the components is constant, then you can try this.$parent.$parent. But this way you can get to the Page, but inside the PageForm is problematic, because this is the slot area.

In theory, i can hang a ref on a component, and get a method through it, but the behavior there is unpredictable...

It is most correct to exchange data through props/emit if the components are adjacent.

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda