mirror of
https://github.com/tenrok/vue-form-wizard.git
synced 2026-06-23 15:20:33 +03:00
Filter based on slot content rather than children (assures component insertion order)
This commit is contained in:
@@ -364,7 +364,11 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
getTabs () {
|
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) {
|
activateTab (index) {
|
||||||
let tab = this.tabs[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`)
|
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 () {
|
reinitializeTabs () {
|
||||||
let currentTabs = this.getTabs()
|
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
|
if (this.tabs.length === 0 || this.tabs.length === currentTabs.length) return
|
||||||
this.tabs = currentTabs
|
this.tabs = currentTabs
|
||||||
let oldTabIndex = -1
|
let oldTabIndex = -1
|
||||||
|
|||||||
Reference in New Issue
Block a user