Skip to content

Commit b0c902c

Browse files
committed
refactor: CTabs: change vertical mechanism. CTab: add titleHtml prop
1 parent 11f56ad commit b0c902c

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

src/components/Tabs/CTab.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
export default {
33
name: 'CTab',
44
props: {
5+
titleHtml: String,
56
active: Boolean,
67
disabled: Boolean
78
},

src/components/Tabs/CTabs.vue

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
v-for="(tab, key) in ctabInstances"
77
@click.native="tabClick(tab)"
88
v-bind="tab.$attrs"
9-
:customTitleSlot="tab.$scopedSlots.title"
9+
:title-html="tab.titleHtml"
10+
:custom-title-slot="tab.$scopedSlots.title"
1011
:active="tab === activeTab"
1112
:disabled="tab.disabled"
1213
:key="key"
@@ -29,7 +30,7 @@
2930
</transition>
3031
</div>
3132
</div>
32-
<!-- needed to instantiate CTab components, do nothing -->
33+
<!-- needed to instantiate CTab components, shouldn't render anything -->
3334
<slot></slot>
3435
</div>
3536
</template>
@@ -53,7 +54,7 @@ export default {
5354
default: true
5455
},
5556
noFade: Boolean,
56-
vertical: [Boolean, Number, String],
57+
vertical: [Boolean, Object],
5758
addNavWrapperClasses: [String, Array],
5859
addNavClasses: [String, Array],
5960
addTabsWrapperClasses: [String, Array],
@@ -91,8 +92,13 @@ export default {
9192
return this.activatedTab || this.ctabInstances.filter(el => el.active)[0]
9293
},
9394
gridClasses () {
94-
const cols = this.vertical === true ? 6 : this.vertical
95-
return cols ? { navs: `c-col-sm-${cols}`, content: `c-col-sm-${12-cols}`} : {}
95+
const vertical = this.vertical
96+
if (typeof vertical === 'object' && vertical.navs && vertical.tabs) {
97+
return vertical
98+
} else if (vertical !== false) {
99+
return { navs: 'c-col-sm-4', content: 'c-col-sm-8'}
100+
}
101+
return {}
96102
},
97103
ctabInstances () {
98104
if (this.defaultSlotNodes) {

0 commit comments

Comments
 (0)