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:
@@ -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
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user