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

103
Visualizações
@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 Respostas
Responde à pergunta

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 Relatório
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