admin管理员组

文章数量:1122846

Using component with the custom icon works anyway, but trying to mark the location using the tool in the right side doesn't show the marker image. Thanks in advance.

const MarkerIcon = new L.Icon({
  iconUrl: '/images/locationMarker.svg',
  iconSize: [40, 40],
});
L.Marker.prototype.options.icon = MarkerIcon;
L.Icon.Default.mergeOptions({
   iconRetinaUrl: require('../images/locationMarker.svg'),
   iconUrl: require('../images/locationMarker.svg'),
   shadowUrl: require('../images/locationMarker.svg'),
});
L.Icon.Default.mergeOptions({
   iconRetinaUrl: require('leaflet/dist/images/marker-icon-2x.png'),
   iconUrl: require('leaflet/dist/images/marker-icon.png'),
   shadowUrl: require('leaflet/dist/images/marker-shadow.png'),
});

All the above snippets didn't work.

本文标签: React Leaflet quotDraw a Markerquot option doesnt show marker iconStack Overflow