我一直在尝试使用ngx传单的自定义集群选项,但遇到了困难。现在,我只想更改所有标记簇以显示单词"你好",
演示https://github.com/Asymmetrik/ngx-leaflet-markercluster/tree/master/src/demo/app包含变量,但不进一步,并且文档https://github.com/Asymmetrik/ngx-leaflet-markercluster#leafletmarkerclusteroptions指向传单本身的文档。
据我所知,我应该做这样的事情:
markcluster演示组件.ts
markerClusterGroup: L.MarkerClusterGroup;
markerClusterData: L.Marker[] = [];
markerClusterOptions = L.markerClusterGroup({
iconCreateFunction(cluster) {
return L.divIcon({ html: '<b>hello</b>' });
}
});
有人有这样的例子吗?
感谢
算出
public markerClusterOptions: L.MarkerClusterGroupOptions = {
iconCreateFunction() {
const icon = L.divIcon({
iconSize: [35, 35],
iconAnchor: [10, 10],
popupAnchor: [10, 0],
shadowSize: [0, 0],
html: '<div>Hello</div>'
});
return icon;
}
};