Skip to content

Commit

Permalink
fix(SelectMenu): check null model value
Browse files Browse the repository at this point in the history
Resolves #1421
  • Loading branch information
benjamincanac committed Feb 26, 2024
1 parent 8a1b112 commit 4b6e80e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/runtime/components/forms/SelectMenu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -362,14 +362,16 @@ export default defineComponent({
} else {
return null
}
} else {
} else if (props.modelValue) {
if (props.valueAttribute) {
const option = props.options.find(option => option[props.valueAttribute] === props.modelValue)
return option ? option[props.optionAttribute] : null
} else {
return ['string', 'number'].includes(typeof props.modelValue) ? props.modelValue : props.modelValue[props.optionAttribute]
}
}
return null
})
const selectClass = computed(() => {
Expand Down

0 comments on commit 4b6e80e

Please sign in to comment.