我想在 vue.js 中将鼠标悬停在一个元素上时显示一个 div.但我似乎无法让它工作.
I would like to show a div when hovering over an element in vue.js. But I can't seem to get it working.
vue.js 中的 hover
或 mouseover
似乎没有事件.这是真的吗?
It looks like there is no event for hover
or mouseover
in vue.js. Is this really true?
可以结合jquery hover和vue方法吗?
Would it be possible to combine jquery hover and vue methods?
这里不需要方法.
HTML
<div v-if="active">
<h2>Hello World!</h2>
</div>
<div v-on:mouseover="active = !active">
<h1>Hover me!</h1>
</div>
JS
new Vue({
el: 'body',
data: {
active: false
}
})
这篇关于鼠标悬停或悬停 vue.js的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!