Skip to content

Commit

Permalink
fix(comp:select): blur event clear input value
Browse files Browse the repository at this point in the history
  • Loading branch information
kovsu committed Feb 8, 2023
1 parent 378d1c4 commit 64fce3f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,6 @@ export function useInputState(props: SelectorProps, mergedSearchable: ComputedRe
}

const handleBlur = (evt: FocusEvent) => {
if (props.allowInput && !props.multiple) {
props.value[0] = inputValue.value
inputValue.value = ''
}
isFocused.value = false
callEmit(props.onBlur, evt)
}
Expand Down
8 changes: 7 additions & 1 deletion packages/components/select/src/Select.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,13 @@ export default defineComponent({
}
}

const handleBlur = () => accessor.markAsBlurred()
const handleBlur = () => {
if (props.allowInput && inputValue.value) {
changeSelected(inputValue.value)
clearInput()
}
accessor.markAsBlurred()
}
const handleItemRemove = (value: VKey) => {
focus()
handleRemove(value)
Expand Down

0 comments on commit 64fce3f

Please sign in to comment.