Skip to content

Props ​

PropDescriptionTypeDefault
defaultTabsDefault tabs, applied on initialization only (later prop changes are ignored)ITabData[][]
homeTabPinned home tab: always first, non-closable and non-draggable; other tabs cannot move before it. Omit to keep previous behaviorITabData—
maxMax open tabsnumber20
contextmenuRight-click context menu. true (default) = built-in menu; false = browser default; IContextMenu[] = append custom itemsboolean | IContextMenu[]true
pageTransitionForward page transition namestringstack-tab-swap
pageTransitionBackBackward page transition namestringstack-tab-swap-back
tabTransitionTab transition name. Accepts string or TransitionProps objectstring | TransitionPropsstack-tab-zoom
tabScrollModeTab bar scroll modeTabScrollMode.WHEEL | BUTTON | BOTHTabScrollMode.BOTH
spacePixel distance scrolled per tab bar stepnumber300
widthComponent widthstring100%
heightComponent heightstring100%
i18nLocale. Built-in values: zh-CN, enstringzh-CN
globalScrollUse page-level scrollbooleanfalse
scrollContainerCustom scroll component rendered inside each cached page; must render the default slot and expose scrollElement (or a StackTabsScrollAdapter)Component—
iframePathiframe route path (required)string—
iframeAllowedOriginsAllowed origins for postMessage openTab, merged with the current originstring[][]
iframeSandboxiframe sandbox attribute. The default includes allow-same-origin, which is unsafe for same-origin pages; remove it when embedding same-origin content. Intended for cross-origin third-party pagesstringallow-scripts allow-forms allow-popups allow-downloads allow-same-origin
iframeReferrerPolicyiframe referrerpolicyReferrerPolicystrict-origin-when-cross-origin
iframeAllowiframe allow attribute (Permissions Policy)string''
iframeLoadTimeoutiframe load timeout (ms); shows error UI on timeoutnumber15000
sessionPrefixPrefix for sessionStorage keys; useful when hosting multiple instances on the same originstring''

Note: iframePath is required. When it is missing, the component throws an Error in development and logs console.error in production. See Nuxt and iframe & Parent Communication.

Events ​

EventPayloadDescription
onActiveid: stringFired when a tab becomes active, whether by a click or by an API call.
onPageLoaded—Fired when the page inside a tab mounts or is reactivated from the keep-alive cache.
vue
<template>
  <vue-stack-tabs
    iframe-path="/iframe"
    @on-active="(id) => console.log('active tab:', id)"
    @on-page-loaded="() => console.log('page ready')"
  />
</template>

onPageLoaded fires on every activation of a cached page, not only on its first mount.

Released under the Apache License.