Answer the question
In order to leave comments, you need to log in
Data in the method is not updated when using api 2gis?
Good day, not so long ago with js and vue.
map_get(coor) {
console.log(coor)
this.dialog = true;
var map;
var STO = DG.then(function () {
map = DG.map('map', {
center: [coor.latitude,coor.longitude],
zoom: 13
});
DG.marker([coor.latitude,coor.longitude]).addTo(map).bindPopup('Наше СТО');
});
Answer the question
In order to leave comments, you need to log in
On the first call, create a map and a marker, make them properties of the component, update the coordinates on subsequent calls:
if (!this.map) {
this.map = DG.map(...);
this.marker = DG.marker(...);
} else {
this.map.panTo(...)
this.marker.setLatLng(...);
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question