1 <img class="center-block" :src="item.prc" :id="forId(index)" alt="logo" 2 @mouseleave="zleave(item.prc,index)" @mouseenter="zenter(item.img,index)" 3 style="height: 100%;width: 100%">
在methods里面定义,鼠标移入移出事件,JQ id选择器更改图片的src属性就好了
1 methods: { 2 forId: function (index) { 3 return "zimg" + index 4 }, 5 zleave(imgsrc, index) { 6 document.getElementById("zimg" + index).src = imgsrc; 7 }, 8 zenter(imgsrc, index) { 9 document.getElementById("zimg" + index).src = imgsrc; 10 }14 },
原文:https://www.cnblogs.com/LilLazy/p/14524856.html