Skip to content

⬅️ Back to Table of Contents

📄 index.ts

📊 Analysis Summary

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

📚 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>

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

    /**
     * Get the dom element of a ref of element or Vue component instance
     *
     * @param elRef
     */
    

  • Parameters:

  • elRef: MaybeComputedElementRef<T>
  • Return Type: UnRefElementReturn<T>
  • Calls:
  • toValue (from vue)

Type Aliases

VueInstance

type VueInstance = ComponentPublicInstance;

MaybeElementRef<T extends MaybeElement = MaybeElement extends MaybeElement = MaybeElement>

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

MaybeComputedElementRef<T extends MaybeElement = MaybeElement extends MaybeElement = MaybeElement>

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

MaybeElement

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

UnRefElementReturn<T extends MaybeElement = MaybeElement extends MaybeElement = MaybeElement>

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