Skip to content

Commit e52934b

Browse files
committed
fix: fixed input accidentally becoming multi-value input
We were not properly checking whether multi-value was enabled or not. An incorrect implementation of "addValue" (now removed) was masking the problem.
1 parent 7b44d82 commit e52934b

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/components/LibInput/LibInput.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ const {
204204
"inner-wrapperAttrs": innerWrapperAttrs,
205205
} = useDivideAttrs(useAttrs(), ["wrapper", "inner-wrapper"])
206206
207-
const values = defineModel<T[]>("values", { default: () => []})
207+
const values = defineModel<T[] | undefined>("values", { default: undefined })
208208
const modelValue = defineModel<T>({ required: true })
209209
210210
@@ -250,12 +250,12 @@ const handleKeydown = (e: KeyboardEvent) => {
250250
// @ts-expect-error awaiting proper types for defineExpose
251251
if (props.suggestions) suggestionsComponent.value?.inputKeydownHandler?.(e)
252252
253-
if (values && e.key === "Enter" && !hasModifiers(e)) {
253+
if (values.value && e.key === "Enter" && !hasModifiers(e)) {
254254
props.preventDuplicateValues
255255
? pushIfNotIn(values.value, [inputValue.value])
256256
: values.value.push(inputValue.value)
257257
}
258-
if (values && e.key === "Escape" && !hasModifiers(e)) {
258+
if (values.value && e.key === "Escape" && !hasModifiers(e)) {
259259
canOpen.value = false
260260
}
261261
emits("keydown", e)

0 commit comments

Comments
 (0)