我是传单 js 的新手。我正在尝试向我的 featureGroup 图层添加一些额外的选项,但它不起作用。
var marker = L.marker(point, { icon: iconMarker, data: random, class: 'hugo', id: random });
var circle = L.circle(point, {
color: 'red',
fillColor: '#f03',
fillOpacity: 0.5,
radius: 20
});
var PoleLayer = L.featureGroup([marker, circle], {
options: {
attribution: "Pole Group",
extra:"extra value",
id:"some id"
}
});
对于 Marker,我能够访问选项,但对于 PoleLayer,我无法设置任何额外选项或访问这些选项,任何人都可以在这里帮助我。
我应该如何为传单js中的featureGroup分配额外的选项?
最佳答案
从传单 1.7 开始,您可以在创建功能组时设置自定义选项:
L.featureGroup(<Layer[]> layers?, options?)
关于javascript - 如何为传单中的featureGroup提供额外的选项?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43536295/