1、vue里面实现hover效果基本需要用事件模拟

<div @mouseover="overShow" @mouseout="outHide"> 

或者是:mouseentermouseleave
 当我用第三方组件的时候加事件的时候没有生效,如给第三方组件ElementUI的button,在绑定mouseover和mouseout事件时,发现绑在按钮上时无效的。
 解决方案:如果这个组件没处理这两个事件的话是绑不了的。添加.native修饰符,就可以把事件绑到组件的根元素上

 <el-button type="primary" @mouseover.native="hover"
@mouseleave.native="knowledge = '知识库搜索答案'">{{knowledge}}</el-button>
Logo

前往低代码交流专区

更多推荐