I'm using vue-select component to search items from an API. After the user has clicked on an Item, I add it to a shopping cart through the @input trigger.
I would like to clear the selection after this, so I actually don't ever need a value to be selected. Is there any option to do this? or any code I can use in the @input trigger?
Here is my example:
<v-select ref='theSelect' v-model="selected" placeholder="Search Items..." label="name" :filterable="false" :options="options" @search="onSearch" @input="addItem(selected)">
addProduct(selected) {
if (selected != null) {
alert(selected.id);
this.addtocart(selected);
this.$refs.theSelect.clearSelection();
this.selected = null;
}
}
This is working, but I wonder if there's a better way to get this done.
I am also doing this and I think it would be easier if we could get a reference to the vue-select instance in the onChange handler
I'm going to close this issue, but ensuring that all events receive the VM instance is high on my list.
Most helpful comment
I am also doing this and I think it would be easier if we could get a reference to the vue-select instance in the
onChangehandler