Commit 52566eab by cwq0219

地图

1 parent 99aaf13f
......@@ -45,6 +45,7 @@
:center='center'
:amap-manager='amapManager'
:zoom='zoom'
:events='events'
class='amap-demo'
>
</el-amap>
......@@ -135,9 +136,11 @@ import VueAMap from 'vue-amap'
import Vue from 'vue'
import { bizMethods, request } from '@/api'
import notice from '@/common/notice'
var marker = []
const amapManager = new VueAMap.AMapManager()
VueAMap.initAMapApiLoader({
key: '44cc16e43ad7ed3358df507bd0618181',
plugin: ['AMap.Geocoder'],
uiVersion: '1.0'
})
Vue.use(VueAMap)
......@@ -206,10 +209,32 @@ export default {
isMap: true
}
],
amapManager,
zoom: 12,
// 地图中心点(初始化得有值);也是标记点
center: [121.59996, 31.197646],
amapManager,
center: [113.939723, 22.525351],
events: {
'click': (e) => {
amapManager._map.remove(marker)
marker = []
this.center = [+e.lnglat.lng, +e.lnglat.lat]
var geocoder = new AMap.Geocoder({
radius: 1000,
extensions: 'all'
})
geocoder.getAddress(this.center, (status, result) => {
if (status === 'complete' && result.info === 'OK') {
console.dir(result)
const mar = new AMap.Marker({
position: this.center,
title: result.regeocode.formattedAddress
})
marker.push(mar)
amapManager._map.add(marker)
}
})
}
},
// 员工状态:0可用,1不可用
status: {
0: '启用',
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!