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)
|
return props.selectPageConfig && (!keywords.value || lastAutocompleteLabel.value === keywords.value)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const showPopover = () => {
|
||||||
|
nextTick(() => {
|
||||||
|
popoverVisible.value = true
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
const loadAutoDataList = (val) => {
|
const loadAutoDataList = (val) => {
|
||||||
if (val || props.emptySearchEnabled) {
|
if (val || props.emptySearchEnabled) {
|
||||||
popoverVisible.value = true
|
showPopover()
|
||||||
loadingData.value = true
|
loadingData.value = true
|
||||||
props.autocompleteConfig.searchMethod({ query: val, page: autoPage.value }, (result) => {
|
props.autocompleteConfig.searchMethod({ query: val, page: autoPage.value }, (result) => {
|
||||||
dataList.value = result.items || []
|
dataList.value = result.items || []
|
||||||
@@ -194,8 +200,8 @@ const onInputKeywords = debounce((input) => {
|
|||||||
if (!props.disabled && !props.readonly) {
|
if (!props.disabled && !props.readonly) {
|
||||||
const val = keywords.value
|
const val = keywords.value
|
||||||
if (showSelectPage.value) {
|
if (showSelectPage.value) {
|
||||||
popoverVisible.value = true
|
|
||||||
loadSelectData()
|
loadSelectData()
|
||||||
|
showPopover()
|
||||||
} else {
|
} else {
|
||||||
if (input && autoPage.value) {
|
if (input && autoPage.value) {
|
||||||
autoPage.value = { ...autoPage.value, pageNumber: 1 }
|
autoPage.value = { ...autoPage.value, pageNumber: 1 }
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ const citySelectPageConfig = computed(() => useCitySelectPageConfig())
|
|||||||
v-model:default-label="modelAutoLabel"
|
v-model:default-label="modelAutoLabel"
|
||||||
id-key="id"
|
id-key="id"
|
||||||
:label-key="$i18nMsg('nameCn', 'nameEn')"
|
:label-key="$i18nMsg('nameCn', 'nameEn')"
|
||||||
:empty-search-enabled="false"
|
:empty-search-enabled="true"
|
||||||
title="请选择用户"
|
title="请选择用户"
|
||||||
:autocomplete-config="userAutocompleteConfig"
|
:autocomplete-config="userAutocompleteConfig"
|
||||||
>
|
>
|
||||||
|
|||||||
Reference in New Issue
Block a user