getLifeCycleTarget
Commons
stable
Returns the provided Vue component instance if given, otherwise falls back to the current Vue lifecycle instance obtained via getCurrentInstance().
API
Signature
Full TypeScript signature sourced from the util file.
API
Parameters
Input parameters accepted by this util.
- targetany
- An optional Vue component instance to use as the lifecycle target. When omitted, the current instance from the active setup context is used.
API
Return value
The value returned by this util.
- The resolved Vue component instance, or null when called outside a setup context and no target was provided.
Usage
Examples
Ready-to-paste usage snippets.
Resolve lifecycle target inside a composable