diff --git a/components/AiDvRender.vue b/components/AiDvRender.vue index 96e4bc6b..78c5958d 100644 --- a/components/AiDvRender.vue +++ b/components/AiDvRender.vue @@ -183,13 +183,6 @@ export default { this.timer && clearInterval(this.timer) if (AMap && map) { map.clearMap() - const center = map.getCenter() - const zoom = map.getZoom() - map.on('click', () => { - map.setZoomAndCenter(zoom, center) - map.setPitch(0) - this.mapDialog = false - }) const markers = Array.isArray(this.values) ? this.values : this.values.markers const polylines = Array.isArray(this.values) ? [] : this.values.polylines || [] markers.map(e => ({lng: e['经度'], lat: e['纬度'], label: e['地区名称'], ...e})).filter(e => e.lng).map((e) => { @@ -214,6 +207,13 @@ export default { map, strokeColor: "#00FFAE", ...e, path: e.path.map(p => new AMap.LngLat(p[1], p[0])) })) map.setFitView() + const center = map.getCenter() + const zoom = map.getZoom() + map.on('click', () => { + map.setZoomAndCenter(zoom, center) + map.setPitch(0) + this.mapDialog = false + }) this.data.is3d > 0 && map.setPitch(65) if (this.data.is3dAround == 1) { this.timer = setInterval(() => map.setRotation(360, false, 16000))