Files
element-plus/packages/components/tabs/src/constants.ts
dopamine 21a29c7b1c fix(components): [tabs] ensure label slot updates (#21231)
* fix(components): [tabs] ensure label slot updates

* fix: compatible with Vue 3.4+

* chore: comments
2025-07-04 19:30:02 +08:00

37 lines
914 B
TypeScript

import type {
ComputedRef,
InjectionKey,
Ref,
Slots,
UnwrapRef,
VNode,
} from 'vue'
import type { TabsProps } from './tabs'
import type { TabPaneProps } from './tab-pane'
import type { TabNavInstance } from './tab-nav'
export type TabPaneName = string | number
export type TabsPaneContext = UnwrapRef<{
uid: number
getVnode: () => VNode
slots: Slots
props: TabPaneProps
paneName: ComputedRef<TabPaneName | undefined>
active: ComputedRef<boolean>
index: Ref<string | undefined>
isClosable: ComputedRef<boolean>
isFocusInsidePane: () => boolean | undefined
}>
export interface TabsRootContext {
props: TabsProps
currentName: Ref<TabPaneName>
registerPane: (pane: TabsPaneContext) => void
unregisterPane: (pane: TabsPaneContext) => void
nav$: Ref<TabNavInstance | undefined>
}
export const tabsRootContextKey: InjectionKey<TabsRootContext> =
Symbol('tabsRootContextKey')