2
0
mirror of https://github.com/tenrok/vue-select.git synced 2026-06-19 09:50:33 +03:00

Add option to allow closing a multi-select when a value is selected

This commit is contained in:
Kori Roys
2017-03-31 15:10:24 +02:00
parent 90981a5a7f
commit 897b0d8fb2
3 changed files with 37 additions and 1 deletions
+16 -1
View File
@@ -390,6 +390,16 @@
default: true
},
/**
* Allows user to choose to close the select dropdown when an option is selected.
* set to true when multiple=true to close the dropdown between each selection
* @type {Boolean}
*/
closeOnMultiSelect: {
type: Boolean,
default: false
},
/**
* Tells vue-select what key to use when generating option
* labels when each `option` is an object.
@@ -625,7 +635,12 @@
* @return {void}
*/
onAfterSelect(option) {
if (!this.multiple) {
if (this.multiple) {
if (this.closeOnMultiSelect) {
this.open = !this.open
this.$refs.search.blur()
}
} else {
this.open = !this.open
this.$refs.search.blur()
}