⾼德地图标注点点击事件⾃定义参数
init() {
var provinces = this.provinces;
if (!provinces || provinces.length == 0) {
return fal;
}
var hmap = {
resizeEnable: true,
center: ["106.687915", "26.499209"],
zoom: 10
};
家风演讲稿var map = new AMap.Map("container", hmap);
var markers = []; //province见Demo引⽤的JS⽂件
//var longitudeArr=[];//经度
//var latitudeArr=[];//纬度
for (var i = 0; i < provinces.length; i += 1) {
var marker;
var nposition = provinces[i].center.split(",");
//console.log("nposition》》》》",nposition);
if (nposition[0] == "26.571257") {
return fal;
}
if (nposition.length == 2) {
//longitudeArr.push(nposition[0]);
//latitudeArr.push(nposition[1]);
if (provinces[i].type == 0) {
var icon = new AMap.Icon({
image: "/icons/b18/1/2.png",
size: new AMap.Size(24, 24)
});
marker = new AMap.Marker({
icon: icon,
position: nposition,
offt: new AMap.Pixel(-12, -12),
zIndex: 101,
title: provinces[i].name,
中班科学活动教案map: map
});
} el {
var redicon = new AMap.Icon({劝说作文
image: require("../asts/red.png"),
size: new AMap.Size(24, 24)
});
var blueicon = new AMap.Icon({
image: require("../asts/blue.png"),
size: new AMap.Size(24, 24)
});
//判断显⽰那个图标
if (provinces[i].workStatus == 0) {
marker = new AMap.Marker({
position: nposition,
title: provinces[i].name,
map: map,
icon: redicon,
});
1642年>肖山令
} el {龙鳞宫
marker = new AMap.Marker({
position: nposition,
title: provinces[i].name,
map: map,
icon: blueicon,
clickable: true,
});
});
}
//添加参数
marker.projectId=provinces[i].projectId;
if (provinces[i].type === 2) {
var content = "<div class = 'taiwan'>宝岛台湾</div>"; baodao = new AMap.Marker({
content: content,玉渊潭中学
position: nposition,
title: provinces[i].name,
offt: new AMap.Pixel(0, 0),
map: map
});
}
}
//点标注的点击事件
<('click', function(e) {
console.log(e.target.projectId);
});
markers.push(marker);
球类运动的英文}
}
//在视野中显⽰所有的点
map.tFitView();
},