mirror of https://github.com/vuejs/core.git
Merge 7d84f7d85f
into bb4ae25793
This commit is contained in:
commit
540b1ffb84
|
@ -16,10 +16,25 @@ export let currentInstance: GenericComponentInstance | null = null
|
||||||
export const getCurrentGenericInstance: () => GenericComponentInstance | null =
|
export const getCurrentGenericInstance: () => GenericComponentInstance | null =
|
||||||
() => currentInstance || currentRenderingInstance
|
() => currentInstance || currentRenderingInstance
|
||||||
|
|
||||||
export const getCurrentInstance: () => ComponentInternalInstance | null = () =>
|
/**
|
||||||
currentInstance && !currentInstance.vapor
|
* Retrieves the current component instance.
|
||||||
? (currentInstance as ComponentInternalInstance)
|
*
|
||||||
|
* @param generic - A boolean flag indicating whether to return a generic component instance.
|
||||||
|
* If `true`, returns a `GenericComponentInstance` including vapor instance.
|
||||||
|
* If `false` or unset, returns a `ComponentInternalInstance` if available.
|
||||||
|
* @returns The current component instance, or `null` if no instance is active.
|
||||||
|
*/
|
||||||
|
export function getCurrentInstance(
|
||||||
|
generic: true,
|
||||||
|
): GenericComponentInstance | null
|
||||||
|
export function getCurrentInstance(
|
||||||
|
generic?: boolean,
|
||||||
|
): ComponentInternalInstance | null
|
||||||
|
export function getCurrentInstance(generic?: boolean) {
|
||||||
|
return currentInstance && (generic || !currentInstance.vapor)
|
||||||
|
? currentInstance
|
||||||
: currentRenderingInstance
|
: currentRenderingInstance
|
||||||
|
}
|
||||||
|
|
||||||
export let isInSSRComponentSetup = false
|
export let isInSSRComponentSetup = false
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue