【发布时间】:2020-04-27 11:02:31
【问题描述】:
如何为地图切片图层添加自定义背景颜色。使用 css 类?
function initLayer(item, map) {
const stateLayer = L.geoJSON(item, {
style: function(feature) {
return {
weight: 8,
opacity: 1,
color: '#333',
fillOpacity: 1,
className: 'gradient-class' // add custom class
}
},
});
map.addLayer(stateLayer);
}
【问题讨论】:
-
您无法更改图块的颜色。瓷砖是一组图像。您只能使用不同的磁贴提供程序