unrefElement

Commons
stable

Unwrap a Vue template ref or getter to the underlying DOM element. Handles both component refs (reads .$el) and plain element refs.

API

Signature

Full TypeScript signature sourced from the util file.

typescript

API

Parameters

Input parameters accepted by this util.

elRef
required
Ref
A Vue ref that may point to a component instance (with .$el) or directly to an HTMLElement. Functions are called to resolve the value.

API

Return value

The value returned by this util.

The raw DOM node, or null/undefined when the ref has not yet been mounted.

Usage

Examples

Ready-to-paste usage snippets.

Access the DOM node from a template ref

typescript