|
@@ -502,6 +502,7 @@ export default {
|
|
|
// 请求并渲染新的区域图层
|
|
|
get("./static/json/simplified_pdgeojson.json", "").then((geoJson) => {
|
|
|
// 存放所有的面数据
|
|
|
+ console.log(this.$store.state.homeSpecialTown, "当前镇");
|
|
|
map2DViewer.groups["浦东新区_polygon"] = L.featureGroup();
|
|
|
map2DViewer.groups["浦东新区_label"] = L.featureGroup();
|
|
|
map2DViewer.groups["浦东新区_polygon"].addTo(map2DViewer.map);
|
|
@@ -527,6 +528,16 @@ export default {
|
|
|
!map2DViewer.map.hasLayer(map2DViewer.groups["浦东新区_polygon"])
|
|
|
) {
|
|
|
this.getJSonDataToStreet("", "");
|
|
|
+ // 切换到首页时需定位到当前图层
|
|
|
+ if (this.$store.state.homeSpecialTown === "全部") {
|
|
|
+ this.setView(
|
|
|
+ townLocationMap.get(this.$store.state.homeSpecialTown),
|
|
|
+ 10
|
|
|
+ );
|
|
|
+ } else {
|
|
|
+ let polygon = townPolygonMap.get(this.$store.state.homeSpecialTown);
|
|
|
+ map2DViewer.map.fitBounds(polygon.getBounds());
|
|
|
+ }
|
|
|
} else if (
|
|
|
!(this.$ifMenu("1", "") || this.$ifMenu("2", "")) &&
|
|
|
map2DViewer.map.hasLayer(map2DViewer.groups["浦东新区_polygon"])
|