* fix: issue #8278

* fix(components): issue #8728

Co-authored-by: RealityBoy <1923740402@qq.com>
This commit is contained in:
Stephen.K 2022-08-31 15:30:09 +08:00 committed by GitHub
parent a155663f19
commit 59c279e8a1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -144,6 +144,7 @@ const regionRef = ref<HTMLElement>()
const popperRef = ref<TooltipInstance>()
const listboxRef = ref<HTMLElement>()
let readonly = false
let ignoreFocusEvent = false
const suggestions = ref<AutocompleteData>([])
const highlightedIndex = ref(-1)
@ -249,7 +250,8 @@ const handleFocus = (evt: FocusEvent) => {
activated.value = true
emit('focus', evt)
if (props.triggerOnFocus) {
// fix https://github.com/element-plus/element-plus/issues/8278
if (props.triggerOnFocus && !readonly) {
debouncedGetData(String(props.modelValue))
}
}
@ -355,6 +357,8 @@ onMounted(() => {
'aria-activedescendant',
`${listboxId.value}-item-${highlightedIndex.value}`
)
// get readonly attr
readonly = (inputRef.value as any).ref!.hasAttribute('readonly')
})
defineExpose({