{
@@ -223,6 +236,12 @@ watch(
watch(
() => props.searchText,
(newVal, oldVal) => {
+ // 同步更新 state.searchText
+ state.searchText = newVal
+ // 清空搜索结果
+ state.searchResult = null
+ // 重置页码
+ state.pageNum = 1
//重置点击停留列表项
state.clickStayItem = ''
emits('clickStayItemChange', state.clickStayItem)
@@ -232,18 +251,6 @@ watch(
}
)
-//输入搜索文本
-const inputSearchText = (e) => {
- if (e.trim() != state.searchText.trim()) {
- state.pageNum = 1
- state.searchResult = null // 清空搜索结果
- }
- state.searchText = e.trim()
- if (!e.trim()) {
- state.searchResult = null // 清空搜索结果
- }
-}
-
// ES搜索聊天记录-主页搜索什么都有、指定用户、指定群、群与用户概览
const queryAllSearch = (doClearSearchResult) => {
if (doClearSearchResult) {
@@ -369,6 +376,7 @@ const queryAllSearch = (doClearSearchResult) => {
} else {
state.hasMore = true
}
+ emits('resultTotalCount', total)
// zPaging.value?.completeByTotal([data], total)
} else {
state.searchResult = data
@@ -534,10 +542,9 @@ const doLoadMore = (doClearSearchResult) => {
return
}
state.loading = true
- queryAllSearch(doClearSearchResult)
- .finally(() => {
- state.loading = false
- })
+ queryAllSearch(doClearSearchResult).finally(() => {
+ state.loading = false
+ })
}