vue绑定div鼠标移入移出事件

1.两种绑定方式

<div v-on:mouseover="handleOver($event)" v-on:mouseout="handleOut($event)">div>
<div @mouseover="mouseOver" @mouseleave="mouseLeave">div>
 
 
handleOver (e) {
    console.log('移入:', e);
    e.currentTarget.className = "xxx";
},
 
handleOut (e) {
    console.log('移出:', e);
    e.currentTarget.className = "yyy";
},
mouseOver () {},
 
mouseLeave () {}

你可能感兴趣的:(vue.js,前端,javascript)