Skip to content

Component instance API

Roberto Asiel Guevara Castañeda edited this page Nov 27, 2019 · 7 revisions

Component instance API

Properties

  • $parent: Component | null
    Parent component of the component child. If instance is the root component this property is null.

  • $parentEl: HTMLElement | DocumentFragment
    Parent element of the component.

  • $siblingEl: HTMLElement | null
    Sibling element of the component.

  • $refs: { [refName: string]: HTMLElement | HTMLElement[] } - read only
    Property that contains the reference elements declared in the component template. If the reference is declared inside a loop, the property will be an array of elements.

  • $slots: ObjectLike<DocumentFragment> - read only
    Property that contains the slots declared in the component template.

  • $filters: { [filterName: string]: (...args: any[]) => any } - read only
    Property that contains the filters declared in the component options.

  • $options: ComponentOptions - read only
    Property that contains the component options.

  • $children: Component[] - read only
    Property that contains the component instances declared in the component template.

Methods

  • $get<T>(path: string): T
  • $set<T>(keyPath: string, value: T): void
  • $create(): void
  • $mount(parent: string | Element, sibling?: string | boolean | Element): void
  • $unmount(): void
  • $update(): void
  • $destroy(): void
  • $on(event: string, handler: (data?: any) => void): { $off(): void }
  • $once(event: string, handler: (data?: any) => void): void
  • $off(event: string, handler: (data?: any) => void): void
  • $fire(event: string, data?: any): void
  • $notify(key: string): void
  • $observe(key: string | string[], handler: () => void): { $unobserve(): void }
  • $watch(key: string, handler: (oldValue?: any, newValue?: any) => void): { $unwatch(): void }
Clone this wiki locally