I would like to show a div when hovering over an element in vue.js. But I can\'t seem to get it working.
It looks like there is no event for hover or mouseover in vue.j
Please take a look at the vue-mouseover package if you are not satisfied how does this code look:
vue-mouseover provides a v-mouseover
directive that automaticaly updates the specified data context property when the cursor enters or leaves an HTML element the directive is attached to.
By default in the next example isMouseover
property will be true
when the cursor is over an HTML element and false
otherwise:
Also by default isMouseover
will be initially assigned when v-mouseover
is attached to the div
element, so it will not remain unassigned before the first mouseenter
/mouseleave
event.
You can specify custom values via v-mouseover-value
directive:
or
Custom default values can be passed to the package via options object during setup.