如图所示我想实现当鼠标划入时右上角的设置图标显示,鼠标移出设置图标在隐藏,可以通过vue的@mouseenter和@mouseleave事件来实现
<!--
这个@mouseenter和@mouseleave需要放在父级盒子内
首先需要在data里面定义一个rightTopIconIndex=-1
触发@mouseenter事件时rightTopIconIndex等于当前划过的这个模块的下标
触发@mouseleave事件时在给rightTopIconIndex赋值为-1
然后在要显示的设置图标的盒子内判断rightTopIconIndex是否等于当前父盒子的下标
-->
<div
v-for="(item, index) in applicationList"
:key="index"
@mouseenter="rightTopIconIndex = index"
@mouseleave="rightTopIconIndex = -1"
>
<div class="rightTopIcon" v-show="rightTopIconIndex == index">
<i class="el-icon-s-tools"></i>
</div>
</div>