JSFiddle - React, Tailwind, and code Playground
by zoomieos
JavaScript
mapCreated: function ($map) {
let pointOnMap = new ymaps.Placemark([55.7204,37.6200], {}, {
draggable: true
});
$map.geoObjects.add(pointOnMap);
this.map = $map
let coords = [55.7204,37.6200]
pointOnMap.events.add("dragend", function (e) {
let coords = this.geometry.getCoordinates();
let new_coords = coords[1].toFixed(6) + ',' + coords[0].toFixed(6);
console.log(new_coords);
axios.get('https://geocode-maps.yandex.ru/1.x/?apikey=key&format=json&geocode='+new_coords).then(resp => {
resp.data.response.GeoObjectCollection.featureMember[0].GeoObject.name
}).catch(e => {
this.error = e
})
}, pointOnMap);