Skip to content

Commit 0952d7d

Browse files
author
drjonnicholson
committed
Added tabData propety that can be passed to the title
1 parent b534a2b commit 0952d7d

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

src/components/VTab.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ export default {
99
type: String,
1010
default: ''
1111
},
12+
tabData: {
13+
type: Object,
14+
default: null
15+
},
1216
/***
1317
* Function to execute before tab switch. Return value must be boolean
1418
* If the return result is false, tab switch is restricted

src/components/VueTabs.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -116,11 +116,16 @@ export default {
116116
let {active, title} = tab
117117
let titleStyles = {color: this.activeTabColor}
118118
if (position === 'center') titleStyles.color = this.activeTextColor
119-
let simpleTitle = (<span class={`title title_${position}`} style={active ? titleStyles : {}}>
120-
{position === 'center' && this.renderIcon(index)}{title}
121-
</span> )
119+
let simpleTitle = (<span class={`title title_${position}`} style={active ? titleStyles : {}}>{position === 'center' && this.renderIcon(index)}{title}</span>)
122120

123121
if (tab.$slots.title) return tab.$slots.title
122+
if (tab.$scopedSlots.title) return tab.$scopedSlots.title({
123+
active: active,
124+
title: title,
125+
position: position,
126+
icon: tab.icon,
127+
data: tab.tabData
128+
});
124129
return simpleTitle
125130
},
126131
renderIcon (index) {

0 commit comments

Comments
 (0)