mirror of
https://github.com/fugary/simple-element-plus-template.git
synced 2025-11-12 14:27:49 +00:00
自动完成优化
This commit is contained in:
@@ -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 }
|
||||
|
||||
@@ -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"
|
||||
>
|
||||
|
||||
Reference in New Issue
Block a user