tmp.addPosition = function (map, item) { var ele = document.createElement("div"); var img = document.createElement("img"); img.setAttribute('src', '/images/blueIcon.png'); var a = document.createElement("a"); a.setAttribute('href', '/pdf?username=' + item.name); a.setAttribute('target', '_black'); a.setAttribute('class', 'positionTitle'); a.innerHTML = item.name; ele.append(img); ele.append(a); var vienna = new Overlay({ position: [item.x,item.y], element: ele }); tmp.map.addOverlay(vienna); }
//调用:
tmp.addPosition(map, { x: 102.57374, y:30.51035,name:'测试点'})