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 446280c commit cbf94a7
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/runtime/components/forms/SelectMenu.vue
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 cbf94a7

Please sign in to comment.