From 1b7979e8b1721b909f14f68b4c595b4ca4855e5b Mon Sep 17 00:00:00 2001 From: Jonathan Bouzekri Date: Thu, 29 Jun 2017 23:28:06 +0200 Subject: [PATCH] init geoloc component --- src/App.vue | 28 ++++++++++++++++++++-------- src/components/GmaltGeoloc.vue | 33 +++++++++++++++++++++++++++++++++ src/components/GmaltSearch.vue | 9 +++++---- src/services/AltService.js | 4 ++-- 4 files changed, 60 insertions(+), 14 deletions(-) create mode 100644 src/components/GmaltGeoloc.vue diff --git a/src/App.vue b/src/App.vue index a0994db..3bc4fb7 100644 --- a/src/App.vue +++ b/src/App.vue @@ -2,13 +2,15 @@
- -

Parent : {{ position.lat }}, {{ position.lngĀ }}

+ +

Parent : {{ lat }}, {{ lngĀ }}

Alt : {{ alt }}

+
+ + + diff --git a/src/components/GmaltSearch.vue b/src/components/GmaltSearch.vue index 8ab8c1a..26b3a71 100644 --- a/src/components/GmaltSearch.vue +++ b/src/components/GmaltSearch.vue @@ -2,12 +2,12 @@
- +
- +
@@ -22,12 +22,13 @@ props: ['lat', 'lng'], methods: { search () { - this.$emit('search', this.position) + this.$emit('search', this.fieldLat, this.fieldLng) } }, data () { return { - position: {lat: this.lat, lng: this.lng} + fieldLat: this.lat, + fieldLng: this.lng } } } diff --git a/src/services/AltService.js b/src/services/AltService.js index 5cd73fb..02b913d 100644 --- a/src/services/AltService.js +++ b/src/services/AltService.js @@ -3,8 +3,8 @@ import * as resolveUrl from 'resolve-url' const apiUrl = resolveUrl(process.env.API_URL, '/altitude') export default { - get (position) { - return fetch(apiUrl + '?lat=' + position.lat + '&lng=' + position.lng) + get (lat, lng) { + return fetch(apiUrl + '?lat=' + lat + '&lng=' + lng) .then(function (response) { if (response.status >= 200 && response.status < 300) { return response