如何在MarkerClusterGroup中设置每个集群的选项

How to set options of each cluster in MarkerClusterGroup

我使用以下方式创建自己的 MarkerClusterGroup:

this.cluster = leaflet.markerClusterGroup({
    zoomToBoundsOnClick: false,
    showCoverageOnHover: false,
    spiderfyDistanceMultiplier: 3,
    spiderLegPolylineOptions: {
        weight: 1.5,
        color: "#1BA5D0",
        lineCap: "butt",
        dashArray: "10 10",
        opacity: 0.5
    }
});

如何为该组内的每个集群应用一些选项(就实际 leaflet.Marker 而言)?特别是,我想设置 riseOnHover: true

我发现 some way 可以使用自定义窗格控制整个 MarkerClusterGroup 定位,但这不是我的情况

我终于明白了。可以在 iconCreateFunction:

中设置选项
this.cluster = leaflet.markerClusterGroup({
    iconCreateFunction: cluster => {
        cluster.options.riseOnHover = true;
    }
});