自动完成优化

This commit is contained in:
Gary Fu
2024-01-06 21:35:58 +08:00
parent 166b0edd21
commit b4cf4963b8
2 changed files with 9 additions and 3 deletions

View File

@@ -161,9 +161,15 @@ const showSelectPage = computed(() => {
return props.selectPageConfig && (!keywords.value || lastAutocompleteLabel.value === keywords.value)
})
const showPopover = () => {
nextTick(() => {
popoverVisible.value = true
})
}
const loadAutoDataList = (val) => {
if (val || props.emptySearchEnabled) {
popoverVisible.value = true
showPopover()
loadingData.value = true
props.autocompleteConfig.searchMethod({ query: val, page: autoPage.value }, (result) => {
dataList.value = result.items || []
@@ -194,8 +200,8 @@ const onInputKeywords = debounce((input) => {
if (!props.disabled && !props.readonly) {
const val = keywords.value
if (showSelectPage.value) {
popoverVisible.value = true
loadSelectData()
showPopover()
} else {
if (input && autoPage.value) {
autoPage.value = { ...autoPage.value, pageNumber: 1 }

View File

@@ -27,7 +27,7 @@ const citySelectPageConfig = computed(() => useCitySelectPageConfig())
v-model:default-label="modelAutoLabel"
id-key="id"
:label-key="$i18nMsg('nameCn', 'nameEn')"
:empty-search-enabled="false"
:empty-search-enabled="true"
title="请选择用户"
:autocomplete-config="userAutocompleteConfig"
>