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-btn @click="viewPopup" rounded="xl" variant="tonal" width="45vw" height="44px">
อนกล</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-card-actions>
@ -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 {