<style>
.main {
height: 300px;
width: 100px;
}
.imgs {
height: 100%;
}
.a {
background-color: brown;
width: 200px;
height: 100px;
}
</style>
<div>
<div>
<img class="imgs" :src="picture" />
</div>
<div
class="a"
@mouseover="everMouseover()"
@mouseleave="elevMouseleave()"
></div>
</div>
<script>
export default {
data() {
return {
imgObj: {
immigrate: require("./img/tu1.jpeg"),
shift_out: require("./img/tu2.jpeg"),
},
picture: require("./img/tu1.jpeg"),
};
},
model: {
//鼠标移入触发
everMouseover: function () {
this.picture = this.imgObj.immigrate;
},
//鼠标移出触发
elevMouseleave: function () {
this.picture = this.imgObj.shift_ouf;
},
},
};
</script>
标签:
vue.js
javascript
本文转载自: https://blog.csdn.net/yzy103yzy/article/details/122323664
版权归原作者 鲨鱼辣椒爱上蟑螂恶霸 所有, 如有侵权,请联系我们删除。
版权归原作者 鲨鱼辣椒爱上蟑螂恶霸 所有, 如有侵权,请联系我们删除。