templateRef

Commons
stable

Create a dual-purpose template ref that can be passed as a Vue callback ref and also read like a normal ShallowRef. Exposes both `.value` (the raw ComponentPublicInstance or HTMLElement) and `.el` (the resolved HTMLElement).

API

Signature

Signature TypeScript complète, extraite du fichier util.

typescript

API

Valeur de retour

La valeur retournée par cet util.

A function that can be used directly as a `:ref` binding, with `.value` (raw ref target) and `.el` (resolved HTMLElement) properties attached.

Usage

Exemples

Extraits de code prêts à coller.

Attach a template ref and read its element

typescript