Skip to content

Commit de0f464

Browse files
author
Jeff
committed
Merge branch 'master' of https://github.com/MrStobbart/vue-select into MrStobbart-master
# Conflicts: # dist/vue-select.js # dist/vue-select.js.map
2 parents 85ae977 + 18416ba commit de0f464

File tree

2 files changed

+23
-5
lines changed

2 files changed

+23
-5
lines changed

dev/dev.html

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,12 @@
7575
<v-select placeholder="filtering with fuse.js" label="title" :options="fuseSearchOptions" :filter="fuseSearch">
7676
<template slot="option" scope="option">
7777
<strong>{{ option.title }}</strong><br>
78-
<em>{{ `${option.author.firstName} ${option.author.lastName}` }}</em>
78+
<em>{{ option.author.firstName + ' ' + option.author.lastName }}</em>
7979
</template>
8080
</v-select>
81+
<v-select placeholder="Vue select with no options and a custom no-option span" >
82+
<span slot="no-options">Custom no options message</span>
83+
</v-select>
8184
</div>
8285
</body>
8386

src/components/Select.vue

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -917,8 +917,8 @@
917917
isOptionSelected(option) {
918918
let selected = false
919919
this.valueAsArray.forEach(value => {
920-
if (typeof value === 'object') {
921-
selected = this.optionObjectComparator(value, option)
920+
if (typeof value === 'object' && this.optionObjectComparator(value, option)) {
921+
selected = true
922922
} else if (value === option || value === option[this.index]) {
923923
selected = true
924924
}
@@ -986,11 +986,26 @@
986986
if (this.clearSearchOnBlur) {
987987
this.search = ''
988988
}
989-
this.open = false
990-
this.$emit('search:blur')
989+
this.closeSearchOptions()
990+
return
991+
}
992+
// Fixed bug where no-options message could not be closed
993+
if(this.search.length === 0 && this.options.length === 0){
994+
this.closeSearchOptions()
995+
return
991996
}
992997
},
993998
999+
/**
1000+
* 'Private' function to close the search options
1001+
* @emits {search:blur}
1002+
* @returns {void}
1003+
*/
1004+
closeSearchOptions(){
1005+
this.open = false
1006+
this.$emit('search:blur')
1007+
},
1008+
9941009
/**
9951010
* Open the dropdown on focus.
9961011
* @emits {search:focus}

0 commit comments

Comments
 (0)