Currently, I'm delving into Vue 3 and encountering a specific issue. The tabs library I'm using only provides tab headers without content panels. To work around this limitation, I've come up with the following solution:
<myTabs/><!-- < -- headers -->
<div v-for="tab in tabs" ><!-- < -- content -->
<keep-alive>
<component v-if="tab.active" :is="tab.component"></component>
</keep-alive>
</div>
The tabs are defined as follows:
const tabs: Array<Tab> = reactive<Array<Tab>>([])
This approach involves iterating through the tabs to display only the active tab's content. However, a drawback arises when the order of tabs is changed (e.g., after swapping), causing a mismatch between the order of content and tabs.
For instance, if I have two tabs (0,1) and swap their positions to (1,0), accessing tab 1 may display the content of tab 0. Can anyone assist me in resolving this issue?