您必须指定图标大小和锚位置,如下所示:
private defaultIcon: Icon = icon({ iconUrl: 'assets/leaflet/marker-icon.png', shadowUrl: 'assets/leaflet/marker-shadow.png', iconSize: [41, 51], // => random values you have to choose right ones for your case iconAnchor: [20, 51] // => random values too });
看这里 : https://leafletjs.com/examples/custom-icons/