Skip to content

move on-suggested to an event #58

@Haroenv

Description

@Haroenv
  • vue-autosuggest version: 1.5.0

Relevant code or config

<vue-autosuggest
  :suggestions="indicesToSuggestions(indices)"
  :on-selected="selectHandler"
  :input-props="{
    style: 'width: 100%',
    onInputChange: refine,
  }"
/>

Problem description:

_onSelected seems to be a fine abstraction, but it's more of a React pattern than a Vue pattern. For that I'd change that to this.$emit('selected', ...data). I'd do a PR but wasn't completely sure what the code all meant :)

Suggested solution:

change to an event for "selected" (with backwards compatibility, like for the other events)

<vue-autosuggest
  :suggestions="indicesToSuggestions(indices)"
  @selected="selectHandler"
  :input-props="{
    style: 'width: 100%',
    onInputChange: refine,
  }"
/>

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions