This commit is contained in:
yanran200730
2023-04-20 16:21:50 +08:00
parent bd5698a781
commit 69b2bd6b6f
3 changed files with 4 additions and 2 deletions

View File

@@ -220,6 +220,7 @@ export default {
this.showMap = false
},
initMap() {
if (this.map) return
AMapLoader.load({
key: '54a02a43d9828a8f9cd4f26fe281e74e',
version: '2.0',
@@ -228,7 +229,7 @@ export default {
this.map = new AMap.Map('map', {
resizeEnable: true,
zooms: [6, 20],
center:[this.lng, this.lat],
center: this.form.lng ? [this.form.lng, this.form.lat] : [this.lng, this.lat],
zoom: 11,
})
this.placeSearch = new AMap.PlaceSearch({ map: this.map })
@@ -286,6 +287,7 @@ export default {
resizeEnable: true,
zooms: [6, 20],
zoom: 11,
center:[lng,lat],
})
let marker = new AMap.Marker({
position: new AMap.LngLat(lng,lat),

View File

@@ -143,6 +143,7 @@
resizeEnable: true,
zooms: [6, 20],
zoom: 11,
center:[lng,lat],
})
let marker = new AMap.Marker({
position: new AMap.LngLat(lng,lat),