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

Signature TypeScript complète, extraite du fichier util.

typescript

API

Paramètres

Paramètres d'entrée acceptés par cet util.

target
any
An optional Vue component instance to use as the lifecycle target. When omitted, the current instance from the active setup context is used.

API

Valeur de retour

La valeur retournée par cet util.

The resolved Vue component instance, or null when called outside a setup context and no target was provided.

Usage

Exemples

Extraits de code prêts à coller.

Resolve lifecycle target inside a composable

typescript