Vue mouseenter mouseleave 切换V-for遍历的数组
<div v-for="(item,index) in platformNoticeAryover" :key="index"><!-- <div @click="listClick(item,index,0)"> --><div @clic
·
<div v-for="(item,index) in platformNoticeAryover" :key="index">
<!-- <div @click="listClick(item,index,0)"> -->
<div @click="listClick(item,index,0)" @mouseenter="mouseOver(index)" @mouseleave="mouseOut(index)">
<img class="consult_right_rigister_img" :src="item.img" alt="">
</div>
</div>
<script>
export default {
data() {
return {
platformNoticeAry: [
{
img: require("../../assets/img/servers_a_01.png")
},
{
img: require("../../assets/img/servers_b_01.png")
},
{
img: require("../../assets/img/servers_c_01.png")
},
{
img: require("../../assets/img/servers_d_01.png")
},
{
img: require("../../assets/img/servers_e_01.png")
}
],
platformNoticeAryover:[..........],
platformNoticeAryon: [.........]
}
},
methods:{
mouseOver(index){
this.platformNoticeAryover[index].img = this.platformNoticeAryon[index].img
},
mouseOut(index){
this.platformNoticeAryover[index].img = this.platformNoticeAry[index].img
}
}
}
</script>
更多推荐
已为社区贡献6条内容
所有评论(0)