|
@@ -82,7 +82,7 @@ export default {
|
|
|
maxZoom: 7,
|
|
|
attributionControl: false,
|
|
|
zoomControl: false
|
|
|
- }).setView(L.latLng(31.14785322514787, 121.50195320451814), 3);
|
|
|
+ }).setView(map2DViewer.map.getCenter(), map2DViewer.map.getZoom());
|
|
|
|
|
|
//添加默认图层
|
|
|
var layer = L.esri
|
|
@@ -94,8 +94,10 @@ export default {
|
|
|
this.layers = layer;
|
|
|
},
|
|
|
setView: function (coord, zoom) {
|
|
|
- let center = L.latLng(coord[0], coord[1]);
|
|
|
- this.map.setView(center, zoom);
|
|
|
+ this.$nextTick(() => {
|
|
|
+ let center = L.latLng(coord[0], coord[1]);
|
|
|
+ this.map.setView(center, zoom);
|
|
|
+ });
|
|
|
},
|
|
|
// 更改地图渲染个数
|
|
|
changeMapSize() {
|
|
@@ -126,7 +128,6 @@ export default {
|
|
|
centerZoomInit: {
|
|
|
handler(newValue, oldValue) {
|
|
|
if (newValue.lat && newValue.lng && newValue.zoom) {
|
|
|
- console.log("newValue", newValue);
|
|
|
let center = L.latLng(newValue.lat, newValue.lng);
|
|
|
this.map.setView(center, newValue.zoom);
|
|
|
}
|