vue-simple-suggest
vue-simple-suggest copied to clipboard
List method always gets the previous model value
I'm submitting a ...
- [x ] bug report
- [x ] support request
What is the current behavior?
The list :list="getSuggestionList"
method is called before the model data have been set
Maybe I do something wrong but:
<vue-simple-suggest
v-model="chosen"
display-attribute="name"
value-attribute="url"
:list="getSuggestionList"
@select="handleSelectedTask"
ref="taskSelectorComponent"
>
methods:
getSuggestionList() {
console.log(this.chosen);
if(this.chosen.length < 2) {
return [];
}
return axios.get(`/api/reports/search-list/${this.chosen}`)
.then(response => {
return response.data;
});
},
When I start to type console.log(this.chosen);
in getSuggestionList
method I'm getting previous value.
e.g. Real typed: 1234 on console: 123
Is it possible make ajax request with actual data? The event @request-start has an actual parameter value but how to set the ajax result into suggested list?
debounce="200" solve it