首先你需要加載完地圖
let map = new AMap.Map('eventHandleMap', {
animateEnable: true,
resizeEnable: true,
zoom: 10,
zooms: [9, 19],
center: [110.205487,25.246257],
mapStyle: '地圖樣式'
});
然後你可以直接把這一部分寫在函數中
let marker = new AMap.Marker({
map:map,
position: [經度,緯度],
icon: '//vdata.amap.com/icons/b18/1/2.png',
label: {
// offset: new AMap.Pixel(-16, -16),//修改label相對於maker的位置
content: 這裏可以是你拼接的html,//這個是可有可無的,你可以自己定義打點的內容寫在這
}
});
如果你想刪除這個打的點
map.remove(marker);