【发布时间】:2017-12-25 04:30:12
【问题描述】:
之前我问过一个关于在 Vue 中删除自定义截断过滤器的问题。请在此处查看问题:
Removing a Vue custom filter on mouseover
但是,我没有提到我正在使用 v-for 循环,当我将鼠标悬停在一个 div 上时,我注意到循环中的所有 div 都应用了相同的操作。我不确定如何只定位悬停在上面的 div。这是我的模板:
<div id="tiles">
<button class="tile" v-for="(word, index) in shuffled" @click="clickWord(word, index)" :title="word.english">
<div class="pinyin">{{ word.pinyin }}</div>
<div class="eng" @mouseover="showAll = true" @mouseout="showAll = false">
<div v-if="showAll">{{ word.english }}</div>
<div v-else>{{ word.english | truncate }}</div>
</div>
</button>
</div>
以及返回的数据:
data(){
return {
currentIndex: 0,
roundClear: false,
clickedWord: '',
matchFirstTry: true,
showAll: false,
}
},
如果您了解 Vue,我将不胜感激。谢谢!
【问题讨论】:
标签: javascript vue.js vuejs2