2018-01-09 17:52:26 +01:00
|
|
|
<template>
|
|
|
|
<div>
|
|
|
|
|
|
|
|
<!--<gmap-autocomplete :value="description" @input="setPlace"
|
|
|
|
@place_changed="setPlace">
|
|
|
|
</gmap-autocomplete>
|
|
|
|
<br />
|
|
|
|
|
|
|
|
<gmap-map
|
|
|
|
:center="center"
|
|
|
|
:zoom="15"
|
|
|
|
style="width: 500px; height: 300px"
|
|
|
|
>
|
|
|
|
<gmap-marker
|
|
|
|
:key="index"
|
|
|
|
v-for="(m, index) in markers"
|
|
|
|
:position="m.position"
|
|
|
|
:clickable="true"
|
|
|
|
:draggable="true"
|
|
|
|
@click="center=m.position"
|
|
|
|
></gmap-marker>
|
|
|
|
</gmap-map>-->
|
|
|
|
{{ center.lat }} - {{ center.lng }}
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
2018-12-21 17:10:39 +01:00
|
|
|
<script lang="ts">
|
|
|
|
import { Component, Prop, Vue } from 'vue-property-decorator';
|
|
|
|
|
|
|
|
@Component
|
|
|
|
export default class Location extends Vue {
|
|
|
|
@Prop(String) address!: string;
|
|
|
|
|
|
|
|
description = 'Paris, France';
|
|
|
|
center = { lat: 48.85, lng: 2.35 };
|
|
|
|
markers: any[] = [];
|
|
|
|
|
2018-11-06 10:30:27 +01:00
|
|
|
setPlace(place) {
|
|
|
|
this.center = {
|
|
|
|
lat: place.geometry.location.lat(),
|
|
|
|
lng: place.geometry.location.lng(),
|
2018-01-09 17:52:26 +01:00
|
|
|
};
|
2018-12-21 17:10:39 +01:00
|
|
|
this.markers = [ {
|
2018-11-06 10:30:27 +01:00
|
|
|
position: { lat: this.center.lat, lng: this.center.lng },
|
2018-12-21 17:10:39 +01:00
|
|
|
} ];
|
|
|
|
|
2018-11-06 10:30:27 +01:00
|
|
|
this.$emit('input', place.formatted_address);
|
2018-12-21 17:10:39 +01:00
|
|
|
}
|
|
|
|
};
|
2018-01-09 17:52:26 +01:00
|
|
|
|
|
|
|
</script>
|