leaflet创建marker
divicon var highlightIcon = L.divIcon({ className: "highlight-divicon" }); L.marker([a.layer._latlng.lat, a.layer._latlng.lng], { icon: highlightIcon }).addTo(this.map); 可以对highlight-divicon样式定义 ,width,height, margin-left,margin-right要用!important提升优先级 图片icon new L.marker([e.latlng.lat, e.latlng.lng], { icon: L.icon({ iconUrl: focusIcon, iconSize: [40, 31], }), class: `focus-icon` } ).addTo(this.map) 来源: oschina 链接: https://my.oschina.net/u/560237/blog/4331295