Skip to content

[Feature] Add a queryComponent helper function #629

@titouanmathis

Description

@titouanmathis
// Get the first instance of component with `config.name === 'Foo'`
queryComponent('Foo'): Foo | undefined;

// Get all instances of component with `config.name === 'Foo'`
queryComponentAll('Foo'): Foo[];

// Get the first instance of component with `config.name === 'Foo'` and with a CSS class `css-selector`
queryComponent('Foo(.css-selector)');

// Get the first instance of component with `config.name === 'Foo'` and which is mounted
queryComponent('Foo:mounted');
queryComponent('Foo:destroyed');
queryComponent('Foo:terminated');

// Limit the scope of the search to the given element
queryComponent('Foo', { from: document.documentElement });

// Get closest 
closestComponent('Foo', { from: this.$el });

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions