From c37c6d6a11550cbbfe1cf051aa83adcfac2a53c6 Mon Sep 17 00:00:00 2001 From: Dustin Torres Date: Wed, 12 May 2021 12:26:56 -0700 Subject: [PATCH] Fix that allows for any content in default slot. This addresses an issue when adding anything above tab-content items in the default slot. Without this fix the tab order can get corrupted if dynamically adding or removing tab content components. --- src/components/FormWizard.vue | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/components/FormWizard.vue b/src/components/FormWizard.vue index 41badb4..8e9a1ce 100644 --- a/src/components/FormWizard.vue +++ b/src/components/FormWizard.vue @@ -235,7 +235,8 @@ this.$emit('update:startIndex', nextIndex) }, addTab (item) { - const index = this.$slots.default.indexOf(item.$vnode) + // Index should only be relative to TabContent + const index = this.$slots.default.filter((slotItem) => slotItem.elm.classList && slotItem.elm.classList.contains('wizard-tab-container')).indexOf(item.$vnode) item.tabId = `${item.title.replace(/ /g, '')}${index}` this.tabs.splice(index, 0, item) // if a step is added before the current one, go to it