fix: fixed minor bug

This commit is contained in:
SRP-mango 2023-11-29 17:19:06 +07:00
parent e2075b96d4
commit 82470ecf6b

View file

@ -189,7 +189,7 @@
<v-card-actions class="stick-bottom btnlist-height justify-sa"> <v-card-actions class="stick-bottom btnlist-height justify-sa">
<v-btn @click="viewPopup" rounded="xl" variant="tonal" width="45vw" height="44px"> <v-btn @click="viewPopup" rounded="xl" variant="tonal" width="45vw" height="44px">
อนกล</v-btn> อนกล</v-btn>
<v-btn @click="viewRoute" rounded="xl" variant="flat" class="text-white" width="45vw" height="44px" color="#f16322"> <v-btn @click="enterRoute" rounded="xl" variant="flat" class="text-white" width="45vw" height="44px" color="#f16322">
เรมการนำทาง</v-btn> เรมการนำทาง</v-btn>
</v-card-actions> </v-card-actions>
@ -240,7 +240,9 @@ export default {
return { return {
showPopup: true, showPopup: true,
showRoute: false, showRoute: false,
userLocation: null userLocation: null,
isLocationRequested: false,
}; };
}, },
computed: { computed: {
@ -248,7 +250,9 @@ export default {
return this.showRoute ? '45vh' : '60vh'; return this.showRoute ? '45vh' : '60vh';
}, },
formattedLocation() { 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 `${this.userLocation.lat.toFixed(6)}, ${this.userLocation.lon.toFixed(6)}`;
} }
return 'Location not available'; return 'Location not available';
@ -263,7 +267,11 @@ export default {
this.getUserLocation(); this.getUserLocation();
this.showRoute = true; this.showRoute = true;
}, },
enterRoute() {
console.log("Enter Route");
},
getUserLocation() { getUserLocation() {
this.isLocationRequested = true;
if (navigator.geolocation) { if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(this.setLocation, this.handleLocationError); navigator.geolocation.getCurrentPosition(this.setLocation, this.handleLocationError);
} else { } else {