Commit 913d8557 authored by youjie's avatar youjie

no message

parent 7888e0a0
...@@ -241,7 +241,7 @@ export default { ...@@ -241,7 +241,7 @@ export default {
this.TripMapList.push(JSON.parse(JSON.stringify(obj))); this.TripMapList.push(JSON.parse(JSON.stringify(obj)));
} }
console.log(this.TripMapList, "----TripMapList"); // console.log(this.TripMapList, "----TripMapList");
}, },
deep: true, deep: true,
immediate: true immediate: true
...@@ -367,7 +367,6 @@ export default { ...@@ -367,7 +367,6 @@ export default {
this.SearchCity(x.MId); this.SearchCity(x.MId);
} }
}); });
console.log(this.countriesData,'------=====')
}, },
// 清除已有源 // 清除已有源
ClearSource(Id,type){ ClearSource(Id,type){
...@@ -413,7 +412,9 @@ export default { ...@@ -413,7 +412,9 @@ export default {
this.map.fitBounds(bounds,{ this.map.fitBounds(bounds,{
padding: 150, // 可选:在地图边界周围添加一些内边距 padding: 150, // 可选:在地图边界周围添加一些内边距
}); });
// this.map.setCenter(bounds.getCenter()); if(this.countriesData&&this.countriesData.length>0&&this.countriesData.length==1){
this.map.setCenter(bounds.getCenter());
}
this.addMarker(); //标记 this.addMarker(); //标记
this.createLineHandler(); //连线 this.createLineHandler(); //连线
await this.addCountriesMaker(); //标记国家 await this.addCountriesMaker(); //标记国家
...@@ -912,11 +913,15 @@ export default { ...@@ -912,11 +913,15 @@ export default {
}); });
marker.setLngLat(result); marker.setLngLat(result);
marker.addTo(this.map); marker.addTo(this.map);
marker.on("dragend", function() {
let currentMarkerLngLat = marker.getLngLat(); let currentMarkerLngLat = marker.getLngLat();
let TripMapList = that.TripMapList.filter(y=> y.MName==x.MName) let TripMapList = that.TripMapList.filter(y=> y.MName==x.MName)
TripMapList[0].Lng = currentMarkerLngLat.lng; TripMapList[0].Lng = currentMarkerLngLat.lng;
TripMapList[0].Lat = currentMarkerLngLat.lat; TripMapList[0].Lat = currentMarkerLngLat.lat;
marker.on("dragend", function() {
currentMarkerLngLat = marker.getLngLat();
TripMapList = that.TripMapList.filter(y=> y.MName==x.MName)
TripMapList[0].Lng = currentMarkerLngLat.lng;
TripMapList[0].Lat = currentMarkerLngLat.lat;
}); });
this.countriesMarkers.push(marker); this.countriesMarkers.push(marker);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment