diff --git a/src/views/counter/map2.vue b/src/views/counter/map2.vue index 287958e..88efc1c 100644 --- a/src/views/counter/map2.vue +++ b/src/views/counter/map2.vue @@ -158,6 +158,17 @@ export default { if (this.coordinate === null) { this.coordinate = [113.203460828994, 22.64902452257] } + const map = new AMap.Map('map-container', { + center: this.coordinate, + resizeEnable: true, + zoom: 16 + }) + new AMap.Marker({ + position: this.coordinate, + zIndex: 10, + title: this.deviceList[0].title, + map: map + }) }) } }, @@ -168,10 +179,10 @@ export default { } }, mounted() { - const device_id = this.$store.getters.deviceID if (this.mapClick) { - this.getDevicesInitMap({ device_id }) this.flag = true + const device_id = this.$store.getters.deviceID + this.getDevicesInitMap({ device_id }) } else { this.initMap() }