findChildrenWithProvide

Commons
stable

Walks a Vue VNode tree and returns all ComponentInternalInstance nodes that have a specific injection key in their provides object. Used by layout components to locate child components registered via provide/inject.

API

Signature

Signature TypeScript complète, extraite du fichier util.

typescript

API

Paramètres

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

key
requis
InjectionKey<any> | symbol
The injection key to search for. Components that called provide(key, …) will be collected.
vnode
VNodeChild
The VNode subtree to walk. Typically the subTree of the parent component instance. Undefined returns an empty array.

API

Valeur de retour

La valeur retournée par cet util.

A flat array of all component instances that provide the given key, found anywhere in the VNode subtree.

Usage

Exemples

Extraits de code prêts à coller.

Locate children by injection key

typescript