fix(components): [select] call the exposes blur is invalid (#17691)

* fix(components): [select] call the exposes blur is invalid

closed #17367

* chore: remove the unnecessary code
This commit is contained in:
qiang 2024-09-02 16:37:03 +08:00 committed by GitHub
parent 3f0842124b
commit c24309aea0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 6 additions and 14 deletions

View File

@ -698,13 +698,9 @@ const useSelect = (props: ISelectV2Props, emit) => {
} }
} }
const handleClickOutside = (event: Event) => { const handleClickOutside = () => {
expanded.value = false expanded.value = false
isFocused.value && blur()
if (isFocused.value) {
const _event = new FocusEvent('focus', event)
handleBlur(_event)
}
} }
const handleMenuEnter = () => { const handleMenuEnter = () => {

View File

@ -103,7 +103,7 @@ export const useSelect = (props: ISelectProps, emit) => {
afterComposition: (e) => onInput(e), afterComposition: (e) => onInput(e),
}) })
const { wrapperRef, isFocused, handleBlur } = useFocusController(inputRef, { const { wrapperRef, isFocused } = useFocusController(inputRef, {
beforeFocus() { beforeFocus() {
return selectDisabled.value return selectDisabled.value
}, },
@ -657,20 +657,16 @@ export const useSelect = (props: ISelectProps, emit) => {
} }
const blur = () => { const blur = () => {
handleClickOutside() inputRef.value?.blur()
} }
const handleClearClick = (event: Event) => { const handleClearClick = (event: Event) => {
deleteSelected(event) deleteSelected(event)
} }
const handleClickOutside = (event: Event) => { const handleClickOutside = () => {
expanded.value = false expanded.value = false
isFocused.value && blur()
if (isFocused.value) {
const _event = new FocusEvent('focus', event)
nextTick(() => handleBlur(_event))
}
} }
const handleEsc = () => { const handleEsc = () => {