[Vuejs]-Vue-autosuggest: How to get original context of the autosuggest component on select?

0👍

I solved a similar task. I don’t know correctly solved it but I did like this.
I have added a prop in data object like this:

lastAutoSuggestFocused: null

and created a focus method for a autosuggest element:

doFocus(event){
    this.lastAutoSuggestFocused = event.target;
}

After it when an option are selecting I select lastAutoSuggestFocused:

onSelect(suggestion){
    const listId = this.lastAutoSuggestFocused.id;
    this.lastAutoSuggestFocused = null;
}

May do you have another a solve?

Leave a comment