鼠标事件
<div class="nav" @mouseover="mouseOut()"></div>
<li class="yewu" ref="yewu" @mouseover="mouseOver()" @click="clickdown(2)" :style="{borderBottom:active==2?'2px solid #b81b22':'0'}"></li>
data() {
return {
//定义一下鼠标事件,否则会出现鼠标事件没有在原型链上定义的问题
mouseover: "",
mouseout: "",
active:""
};
},
methods: {
mouseOver: function() {
window.event ? (window.event.cancelBubble = true) : e.stopPropagation();
this.$refs.downlist.style.display = "inline-block";
},
mouseOut: function() {
this.$refs.downlist.style.display = "none";
},
none: function() {
this.$refs.downlist.style.display = "none";
},
clickdown: function(x) {
//点击那个标签哪个下面就变色
sessionStorage.setItem("titleactive", x);
this.active = x;
}
}