tabs
tabs copied to clipboard
Ability to add event to tabs to know which is open
Hi there - is there an easy way of tracking which tab is open? Id like to get the tab label when one is clicked - for GA tracking - is there a way to do that?
.
try @tab-selected="tabSelected"
the emit codes:
select (index) {
this.$emit('tab-selected', index)
}
then, you can get the current open tab index. trans the index to label in project codes.
@nfer Could you explain in more detail please? I can't make it work.
I couldn't use nfer's method but it's working for me like this :
<tabs ref="tabs" >
...
</tabs>
When I want to access to the selected index tab, I use :
const index = this.$refs.tabs.realSelectedIndex