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

136
Views
Vue mouseover no causa cambios en los datos

Estoy tratando de adjuntar una directiva v-mouseover a un elemento b-list-group-item bootstrap Vue como se muestra a continuación.

 <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>

La variable isRegisterHover está vinculada al valor booleano en los datos que determina si se mostrará o no el div.

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

El problema es que el div action-canvas-register permanece oculto cuando paso el mouse sobre el elemento, Vue devtool también muestra que los datos permanecen sin cambios cuando paso el mouse sobre ellos. ¿Cómo hago que el valor de isRegisterHover cambie cuando paso el mouse sobre el elemento?

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

0

También podrías hacer esto con CSS puro si quisieras. Podrías hacer algo como:

 <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

Tu código debería funcionar. Mira esto :

Recomendaría usar v-show en lugar de v-if. Mira esto .

 <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!