地址解析器
var myGeo = new BMap.Geocoder();
点坐标转百度坐标
var point = new BMap.Point(float, float);
var convertor = new BMap.Convertor()
convertor.translate(arr, 1, 5, sites => { })
添加自定义图标
var myIcon = new BMap.Icon(siteImgUrl2, new BMap.Size(80, 80), {
anchor: new BMap.Size(35, 55),
imageOffset: new BMap.Size(0 - -5, 0 - 0)
})
myIcon.setImageSize(new BMap.Size(60, 60)); //设置图标大小
var mk = new BMap.Marker(sites.points[0], {
icon: myIcon
}) // 自定义点的图标typeof()!="undefined"
that.map.addOverlay(mk) // 添加覆盖物
图标添加事件
mk.addEventListener("mouseover", function(e) {
<
span style = "white-space:pre" > < /span>
mk.setLabel(new BMap.Label(marker.stationName, {
offset: new BMap.Size(10, -20)
})); //为标注设置一个标签
});
mk.addEventListener("mouseout", function(e) {
var label = this.getLabel()
label.setContent(""); //设置标签内容为空mk
label.setStyle({
borderWidth: "0px"
}); //设置标签边框宽度为0
});
mk.addEventListener("click", () => {
that.addRippleImg(marker); // 添加波纹---点击哪个站点
this.$bus.$emit(
"showTotalStatus",
false,
marker.stationCode,
marker.waterId
);
});