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

130
Views
Vue mouseover not causing changes to the data

I am trying to attach a v-mouseover directive to a bootstrap Vue element b-list-group-item as shown below.

<b-row>
    <b-col cols="3">
    <b-list-group> 
        <b-list-group-item :active="register"
        @click="switchRegister" button 
        @mouseover="isRegisterHover = true"
        @mouseleave="isRegisterHover = false"
        class="border-0 bg-transparent register"> Register </b-list-group-item>
    </b-list-group>
    </b-col>

    <b-col cols="9">
       <div id="action-screen-canvas-register v-if="isRegisterHover"> </div>
    </b-col>
</b-row>

The variable isRegisterHover is tied to the boolean value in the data which determines whether or not the div will be shown.

export default {
  name: 'Home',
  components: {
    Navi
  },
  data() {
    return {
      isRegisterHover: false,
      // ...
    }
  },
  // ...
}

Thing is that the action-canvas-register div remains hidden when I hover the item, Vue devtool also shows that the data remains unchanged when I mouseover them. How do I make the isRegisterHover value change when I mouse-over the item?

about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

You could also do this with pure CSS if you wanted to. You could do something like:

<template>
    <div id="target">Hover this</div>
    <div>...</div>           // This will be hidden when #target is hovered
</template>

<script>
    ...
</script>

<style>
    #target:hover + div {
        visibility: hidden;  // Hides the element like v-show
        or
        display: none;       // Hides the element like v-if
    }
</style>
about 4 years ago · Juan Pablo Isaza Report

0

Your code should work. See this:

I would recommend using v-show instead of v-if. See this.

<script>
export default {
  data() {
    return {
      isRegisterHover: false
    }
  }
}
</script>

<template>
  <div @mouseover="isRegisterHover = true"
       @mouseleave="isRegisterHover = false">Hover this</div>
  <div v-show="isRegisterHover">This will show/hide (v-show)</div>
  <div v-if="isRegisterHover">This will show/hide (v-if)</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!