@@ -627,6 +627,12 @@ const resetSearchState = async () => {
|
||||
emitResultsState()
|
||||
}
|
||||
|
||||
// 从详情页返回时只清理搜索 UI 与分类 marker,不参与地图目标焦点的复位。
|
||||
const returnToCollapsedAfterDetail = async () => {
|
||||
await resetSearchState()
|
||||
uni.hideKeyboard()
|
||||
}
|
||||
|
||||
const handleCancel = async () => {
|
||||
await resetSearchState()
|
||||
uni.hideKeyboard()
|
||||
@@ -744,14 +750,27 @@ const handleSearchClear = async () => {
|
||||
await focusSearchInput()
|
||||
}
|
||||
|
||||
const searchShortcut = async (categoryInput: PoiCategoryDefinition | PoiCategoryId) => {
|
||||
type SearchShortcutOptions = {
|
||||
homeCategoryResults?: boolean
|
||||
}
|
||||
|
||||
const searchShortcut = async (
|
||||
categoryInput: PoiCategoryDefinition | PoiCategoryId,
|
||||
options: SearchShortcutOptions = {}
|
||||
) => {
|
||||
const category = typeof categoryInput === 'string'
|
||||
? getPoiCategoryById(categoryInput)
|
||||
: categoryInput
|
||||
if (!category) return
|
||||
|
||||
const requestSeq = ++searchRequestSeq
|
||||
const useHomeResultList = props.variant === 'home' && !homeExpanded.value
|
||||
const useHomeResultList = props.variant === 'home'
|
||||
&& (options.homeCategoryResults ?? !homeExpanded.value)
|
||||
if (useHomeResultList) {
|
||||
homeExpanded.value = false
|
||||
searchInputFocused.value = false
|
||||
uni.hideKeyboard()
|
||||
}
|
||||
searchKeyword.value = category.label
|
||||
searchDraftKeyword.value = category.label
|
||||
activeCategoryId.value = category.id
|
||||
@@ -778,7 +797,10 @@ const searchShortcut = async (categoryInput: PoiCategoryDefinition | PoiCategory
|
||||
}
|
||||
|
||||
const handleFacilityShortcut = (category: PoiCategoryDefinition) => {
|
||||
void searchShortcut(category)
|
||||
void searchShortcut(category, {
|
||||
// 快捷入口始终进入首页底部分类结果;关键词确认仍保留全屏搜索结果。
|
||||
homeCategoryResults: props.variant === 'home'
|
||||
})
|
||||
}
|
||||
|
||||
const handleSearchConfirm = async (event?: any) => {
|
||||
@@ -959,6 +981,7 @@ defineExpose({
|
||||
expandHomePanel,
|
||||
collapseHomePanel,
|
||||
resetSearchState,
|
||||
returnToCollapsedAfterDetail,
|
||||
focusSearchInput,
|
||||
searchShortcut,
|
||||
retryCurrentSearch,
|
||||
|
||||
Reference in New Issue
Block a user