From cbf94a7247c89ba0bc2624e5462563f016d888f7 Mon Sep 17 00:00:00 2001 From: Benjamin Canac Date: Mon, 26 Feb 2024 10:29:45 +0100 Subject: [PATCH] fix(SelectMenu): check `null` model value Resolves #1421 --- src/runtime/components/forms/SelectMenu.vue | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/runtime/components/forms/SelectMenu.vue b/src/runtime/components/forms/SelectMenu.vue index 8094516050..6c6f7458cd 100644 --- a/src/runtime/components/forms/SelectMenu.vue +++ b/src/runtime/components/forms/SelectMenu.vue @@ -362,7 +362,7 @@ 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 @@ -370,6 +370,8 @@ export default defineComponent({ return ['string', 'number'].includes(typeof props.modelValue) ? props.modelValue : props.modelValue[props.optionAttribute] } } + + return null }) const selectClass = computed(() => {