//非聚合点样式 // var _renderMarker = function (context: any) { // context.marker.setIcon(equipIcon); // context.marker.on('click', (e: any) => { // console.log(context, 'context'); // // context.marker.setIcon(equipIcon); // clusterRef.value = context.data[0]; // context.marker.content = `<div class="speech-bubble"> // <div class="speech-bubbles"> // <div class="ball"></div> // <div class="balls"></div> // <div class="up-arrow"></div> // <div class="up-arrow-border"></div> // <div class="content"> // <div class="info"> // <div class="title"> // ${context.data[0].title} // <img onclick="closeInfoWindow()" src="${iconerror}" alt="" /> // </div> // <div class="bod"> // <div class="location">地址:${context.data[0].location}</div> // <div class="leavefor"> // <div class="clickrate"> // 点击前往: // <img src="${urlImgs}" alt="" onclick="showActionSheet()" /> // </div> // <div class="button"><button onclick="closeInfoWindows()">查看场景</button></div> // </div> // </div> // </div> // </div> // </div> // </div>`; // infoWindow.setContent(e.target.content); // infoWindow.open(map, e.target.getPosition()); // }) // nextTick(() => { // (window as any).closeInfoWindow = () => { // infoWindow.close() // } // (window as any).showActionSheet = () => { // alert(onDeviceReady.value) // if (onDeviceReady.value) { // let url = "https://uri.amap.com/marker?position=" + clusterRef.value.position[0] + "," + // clusterRef.value.position[1] + "&name=" + clusterRef.value.title; // cordova.InAppBrowser.open(url, "_blank", "location=no,zoom=no"); // } else { // window.location.href = // "https://uri.amap.com/marker?position=" + clusterRef.value.position[0] + "," + // clusterRef.value.position[1] + "&name=" + clusterRef.value.title; // } // } // (window as any).closeInfoWindows = () => { // showCurtain.value = !showCurtain.value; // } // }) // }; // //聚合点样式 // var _renderClusterMarker = function (context: any) { // // var div = document.createElement("div"); // // var fontColor = "hsla(120,50%,0%,1)"; // // div.style.width = "37px"; // // div.style.height = "46px"; // // div.innerHTML = context.count; // // div.style.lineHeight = 40 + "px"; // // div.style.color = fontColor; // // div.style.fontSize = "14px"; // // div.style.textAlign = "center"; // // //自定义显示maker 的图标 // // div.style.backgroundImage = "url(../assets/errorRow.svg)" // // context.marker.setOffset(new AMap.Pixel(-40 / 2, -40 / 2)); // context.marker.content('<div style="background-color:#ff0000">1</div>'); // context.marker.on('click', function (e: any) { // console.log(e, 'e'); // infoWindow.setContent(e.target.content); // infoWindow.open(map, e.target.getPosition()); // }); // }; //将图层添加至地图实例 // new AMap.MarkerCluster(map, markerData, { // gridSize: 50, // 聚合网格大小 // maxZoom: 12,// 最大聚合层级, // renderMarker: _renderMarker, //上述步骤的自定义非聚合点样式 // });
高德点聚合
最新推荐文章于 2025-06-18 17:32:11 发布