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:
@@ -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()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user