From e7356b3c3c934deaa73b2aca01f67e414d94ec85 Mon Sep 17 00:00:00 2001 From: SRP-mango Date: Thu, 14 Sep 2023 23:57:18 +0700 Subject: [PATCH] hide search bar after search --- src/views/Home.vue | 53 ++++++++++++++++++++++++++-------------------- 1 file changed, 30 insertions(+), 23 deletions(-) diff --git a/src/views/Home.vue b/src/views/Home.vue index 27f4625..03a2106 100644 --- a/src/views/Home.vue +++ b/src/views/Home.vue @@ -14,30 +14,36 @@ - - + +
+ +
+ + mdi-crosshairs-gps +
-
- -
+
+ +
{ - // Extract latitude and longitude from the selected result const lat = parseFloat(result.lat); const lon = parseFloat(result.lon); - - // Update the center coordinates to move the camera to the selected location center.value = [lon, lat]; + hideSearchResults.value = true; }; const performSearch = async () => { @@ -100,14 +107,14 @@ const performSearch = async () => { `https://nominatim.openstreetmap.org/search?format=json&q=${encodeURIComponent(searchQuery.value)}` ); - // Process the search results and limit to, let's say, 5 results searchResults.value = response.data.slice(0, 5); + + hideSearchResults.value = false; } catch (error) { console.error("Error fetching search results:", error); } }; - //Show API const handleMapClick = async event => { const clickedCoordinate = event.coordinate;