vue-search-select
vue-search-select copied to clipboard
Create new option if search returns no results
I have a scenario when an option does not exist in the options list pulled from database and i would like to create it. Basically create if not exists and select if exists. All of the components seem to delete the search text from the input if no match is found.
i have same problem
I have same problem [2]
I Think, provide "Create new option" feature is not the scope if vue-search-select. But if there is feature like show empty result with text and link that event attached, we can handle this.

How others are handling this requirement since the functionality is not available in the library yet?
@coderabsolute What I do is create an item automatically for each character that is written. For example if you wrote "abc", then a single abc element will appear. id: -1
is a wildcard to know what a new element is.
More or less this is my code:
<model-list-select @searchchange="getItems"></model-list-select>
getItems(text){
if (response.status == 200 && response.body.results.length! = 0) {
this.settlementOrigin.items = response.body.results;}
else {
// If not, we create the same
this.settlementOrigin.items = [{id: -1, settlement: text}];
}}