From 37a565535e009f5fffbbd95e323c0fa327d9b769 Mon Sep 17 00:00:00 2001 From: tugcekucukoglu Date: Tue, 19 Mar 2024 11:02:12 +0300 Subject: [PATCH] Fixed #5435 - Autocomplete: isSelected(option) doesn't work correctly when 'multiple' is true --- components/lib/autocomplete/AutoComplete.vue | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/components/lib/autocomplete/AutoComplete.vue b/components/lib/autocomplete/AutoComplete.vue index 01782561e..64ec56ef5 100755 --- a/components/lib/autocomplete/AutoComplete.vue +++ b/components/lib/autocomplete/AutoComplete.vue @@ -771,8 +771,13 @@ export default { isValidSelectedOption(option) { return this.isValidOption(option) && this.isSelected(option); }, + isEquals(value1, value2) { + return ObjectUtils.equals(value1, value2, this.equalityKey); + }, isSelected(option) { - return ObjectUtils.equals(this.modelValue, this.getOptionValue(option), this.equalityKey); + const optionValue = this.getOptionValue(option); + + return (this.modelValue || []).some((value) => this.isEquals(value, optionValue)); }, findFirstOptionIndex() { return this.visibleOptions.findIndex((option) => this.isValidOption(option));