From 6df6f84afe78671d4e0f51b763809a6b2aa2bb2c Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Sat, 8 Jun 2024 19:02:51 -0500 Subject: [PATCH] Add "use my current location" button to home page --- src/views/HomeView.vue | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/views/HomeView.vue b/src/views/HomeView.vue index c704a46..33b6d30 100644 --- a/src/views/HomeView.vue +++ b/src/views/HomeView.vue @@ -20,6 +20,18 @@ export default { methods: { + useCurrentLocation() { + + if (location.protocol == 'http:') { + alert("Sorry, this only works for secure sites.") + } + + navigator.geolocation.getCurrentPosition(loc => { + this.coordinates = `${loc.coords.latitude},${loc.coords.longitude}` + this.loadCoordinates() + }) + }, + editLocations() { this.$router.push('/edit-list') }, @@ -124,6 +136,16 @@ export default { +
+
+ + Use My Current Location + +
+