function addMarker() {
if(marker) {
return;
}
var canvas = document.getElementById('canvas');
var ctx = canvas.getContext('2d');
var img = new Image();
img.src = "../img/map_layer_green.png";
img.onload = function() {
ctx.drawImage(img, 0, 0);
ctx.fillText("自己的位置", 0, 0);
console.log(canvas.toDataURL());
}
marker = new plus.maps.Marker(new plus.maps.Point(121.929282, 30.903541));
var bubble = new plus.maps.Bubble('打造最好的HTML5移动开发工具');
marker.setBubble(bubble, true);
map.addOverlay(marker);
bubble.loadImageDataURL(canvas.toDataURL());
}
输出base64转码是正常的,调试台也能看到图片资源加载,但是气泡样式还是默认的,并没有加载canvas自定义的气泡
4***@qq.com (作者)
改成了getElement也还是不显示
2016-12-11 14:19