Skip to content

Commit 80170ca

Browse files
committed
fix(select): use getOptionValue to determine selected options when using isMulti prop
#212 (comment)
1 parent e01b3f3 commit 80170ca

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

Diff for: src/Select.vue

+4-4
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ const availableOptions = computed<GenericOption[]>(() => {
8383
return props.isMulti ? getNonSelectedOptions(options) : options;
8484
});
8585
86-
const selectedOptions = computed(() => {
86+
const selectedOptions = computed<GenericOption[]>(() => {
8787
if (props.isMulti) {
8888
if (!Array.isArray(selected.value)) {
8989
if (!props.disableInvalidVModelWarn) {
@@ -93,9 +93,9 @@ const selectedOptions = computed(() => {
9393
return [];
9494
}
9595
96-
return selected.value.map(
97-
(value) => props.options.find((option) => option.value === value)!,
98-
);
96+
return selected.value
97+
.map((selectedValue) => props.options.find((option) => props.getOptionValue(option) === selectedValue))
98+
.filter((option) => option !== undefined);
9999
}
100100
101101
const found = props.options.find((option) => props.getOptionValue(option) === selected.value);

0 commit comments

Comments
 (0)