2
0
mirror of https://github.com/tenrok/vue-select.git synced 2026-05-17 02:29:37 +03:00

Fixes #671. The method isOptionSelected on options of type 'object' was cycling but no returning after an existing option was found (true), resetting to false on next option.

This commit is contained in:
Cristian Totola
2018-10-25 10:24:13 +02:00
parent e0584cda96
commit b03868c449
+12 -9
View File
@@ -904,15 +904,18 @@
* @return {Boolean} True when selected | False otherwise
*/
isOptionSelected(option) {
let selected = false
this.valueAsArray.forEach(value => {
if (typeof value === 'object') {
selected = this.optionObjectComparator(value, option)
} else if (value === option || value === option[this.index]) {
selected = true
}
})
return selected
let selected = false
let i = 0
while (!selected && i < this.valueAsArray.length) {
let value = this.valueAsArray[i]
if (typeof value === 'object') {
selected = this.optionObjectComparator(value, option)
} else if (value === option || value === option[i]) {
selected = true
}
i++
}
return selected
},
/**