Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

102
Views
@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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!