vue.js mouseover、mouseout BUG? 鼠标滑过子元素,区无法点击子元素
<template><div class="app"><headVue ></headVue><div class="fu"><div class="nav"><ul><li v-fo...
·
<template>
<div class="app">
<headVue ></headVue>
<div class="fu">
<div class="nav">
<ul>
<li v-for="(arr,$index) in arrs" :index="$index" @mouseover="f($index,$event)" @mouseout="ff">{{arr.name}}
<ul class="zi" >
<li v-for="(arr1, $index2) in arr1s" v-if="arr1.flag && $index == $index2"><a :href="arr1.url">{{arr1.text}}</a></li>
</ul>
</li>
</ul>
</div>
</div>
<footerVue></footerVue>
</div>
</template>
<script>
export default {
name: 'app',
data () {
return {
arrs: [
{name: '选项卡1'},
{name: '选项卡2'},
{name: '选项卡3'}
],
arr1s: [
{text: 'text1', url: 'https://www.baidu.com', flag: false},
{text: 'text2', url: 'https://www.mi.com', flag: false},
{text: 'text3', url: 'https://www.ss.com', flag: false}
]
}
},
components: {
},
methods: {
f: function (a, b) {
this.arr1s.forEach(function (ele) {
ele.flag = false
})
this.$set(this.arr1s[a], 'flag', true)
},
ff: function () {
// this.flag = false
this.arr1s.forEach(function (ele) {
ele.flag = false
})
}
}
}
</script>
怎么回事呀。。求解
更多推荐
已为社区贡献2条内容
所有评论(0)