diff --git a/src/runtime/components/InputMenu.vue b/src/runtime/components/InputMenu.vue index 1d321c125f..3d2efdd5dc 100644 --- a/src/runtime/components/InputMenu.vue +++ b/src/runtime/components/InputMenu.vue @@ -293,9 +293,11 @@ function onUpdateOpen(value: boolean) { } function onRemoveTag(event: any) { - const modelValue = props.modelValue as SelectModelValue[] - const filteredValue = modelValue.filter(value => !isEqual(value, event)) - emits('update:modelValue', filteredValue) + if (Array.isArray(props.modelValue)) { + const modelValue = props.modelValue + const filteredValue = modelValue.filter(value => !isEqual(value, event)) + emits('update:modelValue', filteredValue as SelectModelValue) + } } defineExpose({ diff --git a/src/runtime/types/utils.ts b/src/runtime/types/utils.ts index 097ca7ee55..29f22cd6bf 100644 --- a/src/runtime/types/utils.ts +++ b/src/runtime/types/utils.ts @@ -23,7 +23,6 @@ export type PartialString = { [K in keyof T]?: string } -export type MaybeArray = T | T[] export type MaybeArrayOfArray = T[] | T[][] export type MaybeArrayOfArrayItem = I extends Array ? T extends Array ? U : T : never @@ -32,5 +31,5 @@ export type SelectModelValue = (T exten export type SelectItemKey = T extends Record ? keyof T : string export type SelectModelValueEmits = { - 'update:modelValue': [payload: MaybeArray>] + 'update:modelValue': [payload: SelectModelValue] }