leaflet 设置图层优先级
Leaflet 在添加了区域、点位等图层之后,需要设置图层的优先级,可以通过 pane 来设置。
this.map.createPane('tlop')
this.map.getPane('tlop').style.zIndex = 500
let marker = L.polygon(latlngs, {
color: '#0000bf',
fillColor: '#dada3c',
fillOpacity: 0.5,
weight: 2,
pane: 'tlop' // 注意要在图层上使用 pane options 参数,注意 名字要和创建时的tlop保持一致
})
markers.addLayer(marker)
生活是痛苦的白天,死亡是凉爽的夜晚。