2
0
mirror of https://github.com/tenrok/vue-select.git synced 2026-06-22 10:30:34 +03:00

Merge branch 'master' of https://github.com/MrStobbart/vue-select into MrStobbart-master

# Conflicts:
#	dist/vue-select.js
#	dist/vue-select.js.map
This commit is contained in:
Jeff
2019-02-09 15:16:23 -08:00
2 changed files with 23 additions and 5 deletions
+4 -1
View File
@@ -75,9 +75,12 @@
<v-select placeholder="filtering with fuse.js" label="title" :options="fuseSearchOptions" :filter="fuseSearch"> <v-select placeholder="filtering with fuse.js" label="title" :options="fuseSearchOptions" :filter="fuseSearch">
<template slot="option" scope="option"> <template slot="option" scope="option">
<strong>{{ option.title }}</strong><br> <strong>{{ option.title }}</strong><br>
<em>{{ `${option.author.firstName} ${option.author.lastName}` }}</em> <em>{{ option.author.firstName + ' ' + option.author.lastName }}</em>
</template> </template>
</v-select> </v-select>
<v-select placeholder="Vue select with no options and a custom no-option span" >
<span slot="no-options">Custom no options message</span>
</v-select>
</div> </div>
</body> </body>
+19 -4
View File
@@ -917,8 +917,8 @@
isOptionSelected(option) { isOptionSelected(option) {
let selected = false let selected = false
this.valueAsArray.forEach(value => { this.valueAsArray.forEach(value => {
if (typeof value === 'object') { if (typeof value === 'object' && this.optionObjectComparator(value, option)) {
selected = this.optionObjectComparator(value, option) selected = true
} else if (value === option || value === option[this.index]) { } else if (value === option || value === option[this.index]) {
selected = true selected = true
} }
@@ -986,9 +986,24 @@
if (this.clearSearchOnBlur) { if (this.clearSearchOnBlur) {
this.search = '' this.search = ''
} }
this.open = false this.closeSearchOptions()
this.$emit('search:blur') return
} }
// Fixed bug where no-options message could not be closed
if(this.search.length === 0 && this.options.length === 0){
this.closeSearchOptions()
return
}
},
/**
* 'Private' function to close the search options
* @emits {search:blur}
* @returns {void}
*/
closeSearchOptions(){
this.open = false
this.$emit('search:blur')
}, },
/** /**