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

108
Vistas
@mouseover canot change a variable value

Hover event is not working in this vue component, I tried to call a function on hover and it worked but I can't change hover variable directly

<template>
    <div @mouseover="hover = true"
         @mouseleave="hover = false"
        class="dot" style="width: 50px; height: 50px; background-color: darkgreen">
    </div>

</template>

<script>
export default {
  name: "InteractiveDotComponent",
  data(){
    return {
      hover: false//doesn't change on hover
    }
  }
}
</script>

<style scoped>

</style>

using this neither works

 @mouseover="this.hover = true"
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

The hover variable actually is changing. I assume you're inspecting the variable with Vue.js devtools. Unless something in the template is reading the variable, Vue.js devtools won't automatically update it. To see it change, try reading the variable in your template.

<template>
    <div @mouseover="hover = true"
         @mouseleave="hover = false"
        class="dot" style="width: 50px; height: 50px; background-color: darkgreen">
    {{hover}}</div>
</template>
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