diff --git a/docs/api/props.md b/docs/api/props.md index 57fada3..2e11526 100644 --- a/docs/api/props.md +++ b/docs/api/props.md @@ -120,3 +120,11 @@ Selectize.js theme ```js theme: { default: '', type: String } ``` + +## clearSearchText + +Allows component to delete whole option + +```js +clearSearchText: { default: false, type: Boolean } +``` \ No newline at end of file diff --git a/src/components/VSelectize.vue b/src/components/VSelectize.vue index 9aca0af..c7a1bcf 100644 --- a/src/components/VSelectize.vue +++ b/src/components/VSelectize.vue @@ -159,6 +159,11 @@ export default { * Selectize theme */ theme: { default: '', type: String }, + + /** + * Allows component to delete whole option + */ + clearSearchText: { default: false, type: Boolean } }, data: () => ({ @@ -511,9 +516,13 @@ export default { if (typeof option === 'object' && option !== undefined) { option = option[this.label] } - if (this.multiple) { + + if (this.multiple && this.clearSearchText) { + this.searchText = '' + } else if(this.multiple) { this.searchText = option !== undefined ? option : '' } + this.emitInput() this.updateInputWidth() }