Jacobs63/vue3-tabs-component

Select default tab without cache lifetime not possible

Closed this issue · 1 comments

cn42 commented

Is it possible to change the component to be able to set the default tab at start independently?
Now it only works if the cache lifetime is set and active.

Here I found the code to change:

if (props.cacheLifetime > 0) {
const previousSelectedTabHash = expiringStorage.get(storageKey.value)
if (previousSelectedTabHash !== null && findTab(previousSelectedTabHash)) {
selectTab(previousSelectedTabHash)
return
}
if (props.options.defaultTabHash && findTab("#" + props.options.defaultTabHash)) {
selectTab("#" + props.options.defaultTabHash)
return
}
}

Hello,

latest version 1.3.7 fixes this issue, as I believe setting the default tab hash should be a fallback (if specified) regardless of whether the cache is enabled or not.