From 82470ecf6ba9320e27e8946b9d226cadcaa500e5 Mon Sep 17 00:00:00 2001 From: SRP-mango Date: Wed, 29 Nov 2023 17:19:06 +0700 Subject: [PATCH] fix: fixed minor bug --- src/components/DestinationInfoCard.vue | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/components/DestinationInfoCard.vue b/src/components/DestinationInfoCard.vue index b600c5c..a6b60b6 100644 --- a/src/components/DestinationInfoCard.vue +++ b/src/components/DestinationInfoCard.vue @@ -189,7 +189,7 @@ ย้อนกลับ - + เริ่มการนำทาง @@ -240,7 +240,9 @@ export default { return { showPopup: true, showRoute: false, - userLocation: null + userLocation: null, + isLocationRequested: false, + }; }, computed: { @@ -248,7 +250,9 @@ export default { return this.showRoute ? '45vh' : '60vh'; }, formattedLocation() { - if (this.userLocation) { + if (this.isLocationRequested && !this.userLocation) { + return 'Requesting location...'; + } else if (this.userLocation) { return `${this.userLocation.lat.toFixed(6)}, ${this.userLocation.lon.toFixed(6)}`; } return 'Location not available'; @@ -263,7 +267,11 @@ export default { this.getUserLocation(); this.showRoute = true; }, + enterRoute() { + console.log("Enter Route"); + }, getUserLocation() { + this.isLocationRequested = true; if (navigator.geolocation) { navigator.geolocation.getCurrentPosition(this.setLocation, this.handleLocationError); } else {