vue实现鼠标移入移出事件

vue鼠标划过移入移出触发函数介绍

<ul>>
 <li class="" v-on:mouseover="changeActive($event)" v-on:mouseout="removeActive($event)"></li>
</ul>
 
 
methods:{
  // 鼠标移入加入class
  changeActive($event){
    $event.currentTarget.className="active";
  },
  removeActive($event){
    $event.currentTarget.className="";
  }
}

posted on 2019-08-01 18:54  michael-chang  阅读(24698)  评论(0编辑  收藏  举报

导航