【发布时间】:2020-06-02 17:47:15
【问题描述】:
当标签标题悬停时,我正在尝试更改 bootstrap-vue b-tabs 的活动标签,而不仅仅是在单击时。我无法隔离此事件。
在下面的Codepen example 中,我可以在图像悬停时隔离事件,但是我想在标题(例如“试管和小瓶”)悬停时隔离事件。
我对 Vue 还很陌生,所以如果这是一个简单的答案,我深表歉意,但我已经有一段时间没有为此苦苦挣扎了,也无法弄清楚这一点。谢谢!
组件文件
<template>
<b-container class="px-3" fluid>
<div>
<h3>Range Of Glass Products We Inspect</h3>
<p>Anything formed from tubular glass</p>
</div>
<div>
<b-tabs content-class="mt-3" align="left" class="vial-types" vertical>
<b-tab
v-for="glassItem in productRange"
v-bind:key="glassItem.type"
v-bind:ref="glassItem"
v-bind:title="glassItem.type"
@mouseover.native="greet()"
@mouseleave.native="greet()"
>
<b-img
v-bind:src="glassItem.image"
alt="Factory Image">
</b-img>
</b-tab>
</b-tabs>
</div>
</b-container>
</template>
<script>
export default {
name: "ProductRange",
data() {
return {
productRange: [
{type: "Screw & Flanged Head", image:"https://picsum.photos/600/400/", hover: false},
{type: "Tubes and Vials", image:"https://picsum.photos/600/400/", hover: false},
{type: "Pipettes, Syringes, Filling Needles", image:"https://picsum.photos/400/400/",hover: false},
{type: "Ampoules", image:"https://picsum.photos/600/400/", hover: false},
{type: "Custom Geometries Per Customer Specification", image:"https://picsum.photos/600/400/", hover: false}
]
}
},
methods: {
greet: function () {
console.log("Hovering");
}
}
}
</script>
<style lang="sass">
</style>
【问题讨论】:
标签: vue.js bootstrap-vue