fix(components): [autocomplete] SSR hydration error caused by random ID (#15523)

This commit is contained in:
qiang 2024-01-16 22:31:28 +08:00 committed by GitHub
parent 9e7709b58f
commit 9a7ea5c397
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -107,8 +107,8 @@ import { computed, onMounted, ref, useAttrs as useRawAttrs } from 'vue'
import { debounce } from 'lodash-unified'
import { onClickOutside } from '@vueuse/core'
import { Loading } from '@element-plus/icons-vue'
import { useAttrs, useNamespace } from '@element-plus/hooks'
import { generateId, isArray, throwError } from '@element-plus/utils'
import { useAttrs, useId, useNamespace } from '@element-plus/hooks'
import { isArray, throwError } from '@element-plus/utils'
import {
CHANGE_EVENT,
INPUT_EVENT,
@ -154,7 +154,7 @@ const activated = ref(false)
const suggestionDisabled = ref(false)
const loading = ref(false)
const listboxId = computed(() => ns.b(String(generateId())))
const listboxId = useId()
const styles = computed(() => rawAttrs.style as StyleValue)
const suggestionVisible = computed(() => {