fix(components): [select] keep hover after clearing (#9644)

This commit is contained in:
Xc 2022-09-06 12:19:52 +08:00 committed by GitHub
parent 390f5bd8ee
commit dee98ed32a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -322,6 +322,8 @@ export const useSelect = (props, states: States, ctx) => {
(val) => {
if (typeof val === 'number' && val > -1) {
hoverOption.value = optionsArray.value[val] || {}
} else {
hoverOption.value = {}
}
optionsArray.value.forEach((option) => {
option.hover = hoverOption.value === option
@ -590,6 +592,7 @@ export const useSelect = (props, states: States, ctx) => {
}
ctx.emit(UPDATE_MODEL_EVENT, value)
emitChange(value)
states.hoverIndex = -1
states.visible = false
ctx.emit('clear')
}