|
@@ -184,6 +184,16 @@ export default {
|
|
|
},
|
|
|
showType: ["currentJzKey"],
|
|
|
loading: false,
|
|
|
+ markerCache: {
|
|
|
+ "xfscKey": [],
|
|
|
+ "trsyKey": [],
|
|
|
+ "xhsKey": [],
|
|
|
+ "szxhsKey": [],
|
|
|
+ "jzKey": [],
|
|
|
+ "xfzKey": [],
|
|
|
+ "jgKey": [],
|
|
|
+ "xfcKey": []
|
|
|
+ }
|
|
|
};
|
|
|
},
|
|
|
props: {
|
|
@@ -222,12 +232,16 @@ export default {
|
|
|
let showType = JSON.parse(JSON.stringify(this.showType));
|
|
|
if (showType.indexOf(type) >= 0) {
|
|
|
showType = showType.filter((p) => p !== type);
|
|
|
+ this.markerCache[type].forEach(marker => {
|
|
|
+ this.map.remove(marker)
|
|
|
+ })
|
|
|
} else {
|
|
|
showType.push(type);
|
|
|
+ this.markerCache[type].forEach(marker => {
|
|
|
+ this.map.add(marker)
|
|
|
+ })
|
|
|
}
|
|
|
-
|
|
|
this.showType = showType;
|
|
|
- this.getData();
|
|
|
},
|
|
|
async getData() {
|
|
|
if (this.loading) {
|
|
@@ -365,6 +379,8 @@ export default {
|
|
|
offset: new AMap.Pixel(0, -70),
|
|
|
});
|
|
|
|
|
|
+
|
|
|
+
|
|
|
marker.on("mouseover", (e) => {
|
|
|
infoWindow.open(this.map, p.position); //后面的参数指的是经纬度,在此显示窗口
|
|
|
});
|
|
@@ -372,7 +388,7 @@ export default {
|
|
|
marker.on("mouseout", (e) => {
|
|
|
infoWindow.close();
|
|
|
});
|
|
|
-
|
|
|
+ this.markerCache[type].push(marker)
|
|
|
markers.push(marker);
|
|
|
});
|
|
|
this.map.add(markers);
|