Add "use my current location" button to home page
This commit is contained in:
parent
de9980b014
commit
6df6f84afe
1 changed files with 22 additions and 0 deletions
|
@ -20,6 +20,18 @@ export default {
|
||||||
|
|
||||||
methods: {
|
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() {
|
editLocations() {
|
||||||
this.$router.push('/edit-list')
|
this.$router.push('/edit-list')
|
||||||
},
|
},
|
||||||
|
@ -124,6 +136,16 @@ export default {
|
||||||
</o-button>
|
</o-button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<br />
|
||||||
|
<div class="location">
|
||||||
|
<o-button variant="primary"
|
||||||
|
icon-right="location-dot"
|
||||||
|
expanded
|
||||||
|
@click="useCurrentLocation()">
|
||||||
|
Use My Current Location
|
||||||
|
</o-button>
|
||||||
|
</div>
|
||||||
|
|
||||||
</main>
|
</main>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue