Skip to content

Commit 760075a

Browse files
jotoeribackportbot[bot]
authored andcommitted
Free closeOnSelect
Signed-off-by: Jonas Rittershofer <[email protected]>
1 parent da7d35a commit 760075a

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

src/components/Multiselect/Multiselect.vue

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ export default {
171171
]"
172172
:options="options"
173173
:limit="maxOptions"
174-
:close-on-select="!multiple"
174+
:close-on-select="willCloseOnSelect"
175175
:multiple="multiple"
176176
:label="label"
177177
:track-by="trackBy"
@@ -254,6 +254,15 @@ export default {
254254
},
255255
},
256256
257+
/**
258+
* Close the Multiselect when selecting an item.
259+
* Will be overwritten by !multiple if undefined.
260+
*/
261+
closeOnSelect: {
262+
type: Boolean,
263+
default: undefined,
264+
},
265+
257266
/**
258267
* Allow multiple select ?
259268
*/
@@ -373,6 +382,15 @@ export default {
373382
this.$emit('change', value)
374383
},
375384
},
385+
386+
/**
387+
* If closeOnSelect is not manually set, set it to !multiple
388+
* @returns {boolean} closeOnSelect for vue-multiselect
389+
*/
390+
willCloseOnSelect() {
391+
if (this.closeOnSelect === undefined) return !this.multiple
392+
return this.closeOnSelect
393+
},
376394
},
377395
378396
watch: {

0 commit comments

Comments
 (0)