@@ -242,6 +242,16 @@ const isPoiMatchingKeywords = (poi: MuseumPoi, keywords: string[]) => {
|
||||
return keywords.some((keyword) => searchableText.includes(keyword.trim().toLowerCase()))
|
||||
}
|
||||
|
||||
const findShortcutByKeyword = (keyword: string) => {
|
||||
const normalized = keyword.trim().toLowerCase()
|
||||
if (!normalized) return null
|
||||
|
||||
return [...primaryFacilities, ...serviceFacilities].find((shortcut) => (
|
||||
shortcut.label.toLowerCase() === normalized
|
||||
|| shortcut.keywords.some((item) => item.trim().toLowerCase() === normalized)
|
||||
)) || null
|
||||
}
|
||||
|
||||
const syncActiveFloor = () => {
|
||||
if (!displayFloors.value.length) {
|
||||
activeFloor.value = ''
|
||||
@@ -367,6 +377,13 @@ const handleSearchConfirm = async (event?: any) => {
|
||||
searchKeyword.value = value.trim()
|
||||
searchDraftKeyword.value = searchKeyword.value
|
||||
homeExpanded.value = true
|
||||
|
||||
const matchedShortcut = findShortcutByKeyword(searchKeyword.value)
|
||||
if (matchedShortcut) {
|
||||
await searchShortcut(matchedShortcut)
|
||||
return
|
||||
}
|
||||
|
||||
await loadPois(searchKeyword.value)
|
||||
}
|
||||
|
||||
@@ -485,6 +502,11 @@ defineExpose({
|
||||
gap: 8px;
|
||||
overflow-x: auto;
|
||||
padding-bottom: 2px;
|
||||
scrollbar-width: none;
|
||||
}
|
||||
|
||||
.home-category-strip::-webkit-scrollbar {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.home-category-chip {
|
||||
|
||||
Reference in New Issue
Block a user