mirror of
https://github.com/tenrok/vue-form-wizard.git
synced 2026-06-09 10:12:23 +03:00
Filter based on slot content rather than children (assures component insertion order)
This commit is contained in:
@@ -364,7 +364,11 @@
|
||||
}
|
||||
},
|
||||
getTabs () {
|
||||
return this.$children.filter((comp) => comp.$options.name === 'tab-content')
|
||||
let tabs = this.$slots.default.filter((comp) => comp.componentOptions && comp.componentOptions.tag === 'tab-content')
|
||||
.map(comp => {
|
||||
return comp.componentInstance
|
||||
})
|
||||
return tabs
|
||||
},
|
||||
activateTab (index) {
|
||||
let tab = this.tabs[index]
|
||||
@@ -388,8 +392,12 @@
|
||||
console.warn(`Prop startIndex set to ${this.startIndex} is greater than the number of tabs - ${this.tabs.length}. Make sure that the starting index is less than the number of tabs registered`)
|
||||
}
|
||||
},
|
||||
/***
|
||||
* Called when tabs are added dynamically from array
|
||||
**/
|
||||
reinitializeTabs () {
|
||||
let currentTabs = this.getTabs()
|
||||
// The tab count did not change therefore we ignore further checks
|
||||
if (this.tabs.length === 0 || this.tabs.length === currentTabs.length) return
|
||||
this.tabs = currentTabs
|
||||
let oldTabIndex = -1
|
||||
|
||||
Reference in New Issue
Block a user