fix(SelectMenu): check null model value

Resolves #1421
This commit is contained in:
Benjamin Canac
2024-02-26 10:29:45 +01:00
parent 8a1b112727
commit 4b6e80e364

View File

@@ -362,7 +362,7 @@ export default defineComponent({
} else { } else {
return null return null
} }
} else { } else if (props.modelValue) {
if (props.valueAttribute) { if (props.valueAttribute) {
const option = props.options.find(option => option[props.valueAttribute] === props.modelValue) const option = props.options.find(option => option[props.valueAttribute] === props.modelValue)
return option ? option[props.optionAttribute] : null return option ? option[props.optionAttribute] : null
@@ -370,6 +370,8 @@ export default defineComponent({
return ['string', 'number'].includes(typeof props.modelValue) ? props.modelValue : props.modelValue[props.optionAttribute] return ['string', 'number'].includes(typeof props.modelValue) ? props.modelValue : props.modelValue[props.optionAttribute]
} }
} }
return null
}) })
const selectClass = computed(() => { const selectClass = computed(() => {