refElement

Commons
stable

Extract the underlying HTMLElement from a Vue component instance or a raw HTMLElement ref. Handles multi-root components by following the first element sibling of a text node.

API

Signature

Signature TypeScript complète, extraite du fichier util.

typescript

API

Paramètres

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

obj
ComponentPublicInstance<any> | HTMLElement
A Vue component instance (has $el), a raw HTMLElement, or undefined. Returns undefined when the argument is absent or the element cannot be resolved.

API

Valeur de retour

La valeur retournée par cet util.

The resolved HTMLElement, or undefined when the argument is undefined or resolves to a non-element node.

Usage

Exemples

Extraits de code prêts à coller.

Resolve an element from a component ref

typescript