feat(邀请金币代理页面): 搜索功能使用防抖功能

This commit is contained in:
hzj 2025-12-10 10:57:59 +08:00
parent 96be02a679
commit c9087428ff

View File

@ -204,6 +204,7 @@
import { computed, onMounted, ref } from 'vue' import { computed, onMounted, ref } from 'vue'
import { useI18n } from 'vue-i18n' import { useI18n } from 'vue-i18n'
import { setDocumentDirection } from '@/locales/i18n' import { setDocumentDirection } from '@/locales/i18n'
import { useDebounce } from '@/utils/useDebounce'
import { showError, showSuccess } from '@/utils/toast.js' import { showError, showSuccess } from '@/utils/toast.js'
import { handleAvatarImageError } from '@/utils/imageHandler.js' import { handleAvatarImageError } from '@/utils/imageHandler.js'
@ -256,8 +257,9 @@ const handleInputChange = () => {
} }
} }
// //
const handleEnterPress = async () => { const debouncedSearch = useDebounce(
async () => {
console.log('搜索用户id', searchQuery.value) console.log('搜索用户id', searchQuery.value)
searchResults.value = [] searchResults.value = []
selectedUser.value = {} selectedUser.value = {}
@ -269,6 +271,14 @@ const handleEnterPress = async () => {
searchResults.value.push(targetUserInfo) searchResults.value.push(targetUserInfo)
} }
} }
},
500,
true
)
//
const handleEnterPress = () => {
debouncedSearch()
} }
// //