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

223
Vistas
How to use ref on <component> in vuejs?

I am having two independent VUE components and I want to communicate between them.

In the first component, I am using <component> and added ref to it.

<component ref="dynamicComponent"></component>

and in that above dynamic component, there is a method(suppose dynamicMethod) and I want to call that method from second component.

So for that, I am using below code:

this.$root.$refs.dynamicComponent.dynamicMethod();

But I am getting this.$root.$refs a blank object. How can I call that method.

Any help would be appreciated.

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Make sure you're trying to access $refs only after the component is mounted. You should be able to access the $refs in the mounted hook.

mounted: function() {
  console.log(this.$refs);
},
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