Skip to content

⬅️ Back to Table of Contents

📄 unrefElement

📊 Analysis Summary

Metric Count
🔧 Functions 1
📦 Imports 4
📑 Type Aliases 6

📚 Table of Contents

🛠️ File Location:

📂 packages/core/unrefElement/index.ts

📦 Imports

Name Source
ComponentPublicInstance vue
MaybeRef vue
MaybeRefOrGetter vue
toValue vue

Functions

unrefElement(elRef: MaybeComputedElementRef<T>): UnRefElementReturn<T>

Get the dom element of a ref of element or Vue component instance

Parameters:

  • elRef any: No description
Raw JSDoc
/**
 * Get the dom element of a ref of element or Vue component instance
 *
 * @param elRef
 */

Calls:

  • toValue (from vue)
Code
export function unrefElement<T extends MaybeElement>(elRef: MaybeComputedElementRef<T>): UnRefElementReturn<T> {
  const plain = toValue(elRef)
  return (plain as VueInstance)?.$el ?? plain
}

Type Aliases

VueInstance

type VueInstance = ComponentPublicInstance;

MaybeElementRef<T extends MaybeElement = MaybeElement>

type MaybeElementRef<T extends MaybeElement = MaybeElement> = MaybeRef<T>;

MaybeComputedElementRef<T extends MaybeElement = MaybeElement>

type MaybeComputedElementRef<T extends MaybeElement = MaybeElement> = MaybeRefOrGetter<T>;

MaybeElement

type MaybeElement = HTMLElement | SVGElement | VueInstance | undefined | null;

MaybeComputedElementRefOrArray<T extends MaybeElement = MaybeElement>

type MaybeComputedElementRefOrArray<T extends MaybeElement = MaybeElement> = MaybeComputedElementRef<T> | MaybeComputedElementRef<T>[] | MaybeRefOrGetter<T[] | null>;

UnRefElementReturn<T extends MaybeElement = MaybeElement>

type UnRefElementReturn<T extends MaybeElement = MaybeElement> = T extends VueInstance ? Exclude<MaybeElement, VueInstance> : T | undefined;

Generated by Syntax Scribe