Commit 5d4ca84a authored by Michael Underwood's avatar Michael Underwood
Browse files

fix: remove icon option when undefined

Prevents Leaflet from overwriting the default marker icon with
`undefined` and then trying to call `_initIcon` on that.

Resolves #130
parent 28f821ea
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -29,6 +29,12 @@ export default {

    onMounted(async () => {
      const { marker, DomEvent } = await import("leaflet/dist/leaflet-src.esm");
      if (options.icon === undefined) {
        // If the options objection has a property named 'icon', then Leaflet will overwrite
        // the default icon with it for the marker, _even if it is undefined_.
        // This leads to the issue discussed in https://github.com/vue-leaflet/vue-leaflet/issues/130
        delete options.icon;
      }
      leafletRef.value = marker(props.latLng, options);

      const listeners = remapEvents(context.attrs);
+1 −0
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@ export const props = {
  },
  icon: {
    type: [Object],
    default: () => undefined,
    custom: false,
  },
  zIndexOffset: {