8000 Fixed unresponsive vue-select after clicking custom no-options (#689, #648, #722, and #736) as well as isOptionSelected wrong check for object (#732) by MrStobbart · Pull Request #703 · sagalbot/vue-select · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Fixed unresponsive vue-select after clicking custom no-options (#689, #648, #722, and #736) as well as isOptionSelected wrong check for object (#732) #703

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Feb 9, 2019
5 changes: 4 additions & 1 deletion dev/dev.html
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,12 @@
<v-select placeholder="filtering with fuse.js" label="title" :options="fuseSearchOptions" :filter="fuseSearch">
<template slot="option" scope="option">
<strong>{{ option.title }}</strong><br>
<em>{{ `${option.author.firstName} ${option.author.lastName}` }}</em>
<em>{{ option.author.firstName + ' ' + option.author.lastName }}</em>
</template>
</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>
</body>

Expand Down
4 changes: 2 additions & 2 deletions dist/vue-select.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/vue-select.js.map

Large diffs are not rendered by default.

23 changes: 19 additions & 4 deletions src/components/Select.vue
Original file line number Diff line number Diff line change
Expand Up @@ -906,8 +906,8 @@
isOptionSelected(option) {
let selected = false
this.valueAsArray.forEach(value => {
if (typeof value === 'object') {
selected = this.optionObjectComparator(value, option)
if (typeof value === 'object' && this.optionObjectComparator(value, option)) {
selected = true
} else if (value === option || value === option[this.index]) {
selected = true
}
Expand Down Expand Up @@ -975,11 +975,26 @@
if (this.clearSearchOnBlur) {
this.search = ''
}
this.open = false
this.$emit('search:blur')
this.closeSearchOptions()
return
}
// Fixed bug where no-options message could not be closed
if(this.search.length === 0 && this.options.length === 0){
783D
this.closeSearchOptions()
return
}
},

/**
* 'Private' function to close the search options
* @emits {search:blur}
* @returns {void}
*/
closeSearchOptions(){
this.open = false
this.$emit('search:blur')
},

/**
* Open the dropdown on focus.
* @emits {search:focus}
Expand Down
0