fix(components): [input] the cursor error when click show-password (#19003)

closed #18387, #18831
This commit is contained in:
qiang
2024-11-24 20:02:02 +08:00
committed by GitHub
parent 349a2e9c16
commit 6c6e4c67e2
2 changed files with 28 additions and 6 deletions

View File

@ -428,15 +428,13 @@ const {
} = useComposition({ emit, afterComposition: handleInput })
const handlePasswordVisible = () => {
recordCursor()
passwordVisible.value = !passwordVisible.value
focus()
// The native input needs a little time to regain focus
setTimeout(setCursor)
}
const focus = async () => {
// see: https://github.com/ElemeFE/element/issues/18573
await nextTick()
_ref.value?.focus()
}
const focus = () => _ref.value?.focus()
const blur = () => _ref.value?.blur()