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

287
Vistas
Trigger focus and blur on router-link on mouse interaction (Vue)

I have a component with a router-link as the "root element" in Vue and I would like to trigger focus on mouseenter and blur on mouseleave. I have currently set it up like this:

<template>
  <router-link
    :to="LINK"
    ref="card"
    @mouseenter="focus"
    @mouseleave="blur"
  >
    CONTENT
  </router-link>
</template>

<script>
export default {
  methods: {
    focus() {
      this.$refs.card.$el.focus();
    },
    blur() {
      this.$refs.card.$el.blur();
    },
  }
}
</script>

But focus and blur doesn't get triggered when I hover or leave the mouse on the link with this code. I get no errors in the console either. Is there anything additional that needs to be done in order for it to work?

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

0

Really dumb issue, but I simply had to add @mouseenter.native and @mouseleave.native in order to trigger the methods as router-link is obviously a component.

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