marker添加点击事件带参数
一个点为例,遍历添加大家都会。
// 创建一个 Marker 实例:
var marker = new AMap.Marker({
position: new AMap.LngLat(116.397428, 39.90923), // 经纬度对象,也可以是经纬度构成的一维数组[116.39, 39.9]
title: '北京',
extData: {
id:'12345'}
});
marker.on('click',positionResult => {
console.log("绑定点击事件")
console.log(positionResult)
let pointData = positionResult.target.getExtData();
console.log(pointData.id)
});
//添加点标记
this.markerList.push(marker)
//将创建的点标记添加到已有的地图实例
this.map.add(this.markerList);
//移除某个指定marker
this.map.remo