title: Uncaught TypeError: events.forEach is not a function Leaflet and VueJS
body: <p>I am making a vue project and I want to use leaflet inside of my components. I have the map showing but I run into an error when I try to add a marker to the map. I get</p>
  
  <blockquote>
    <p>Uncaught TypeError: events.forEach is not a function
      at VueComponent.addEvents (VM2537 Map.vue:35)
      at e.boundFn (VM2533 vue.esm.js:191)
     at HTMLAnchorElement. (leaflet.contextmenu.js:328)
     at HTMLAnchorElement.r (leaflet.js:5)</p>
  </blockquote>
  
  <pre><code>&lt;template&gt;
    &lt;div&gt;
      &lt;div id="map" class="map" style="height: 781px;"&gt;&lt;/div&gt;
  &lt;/div&gt;
  &lt;/template&gt;
  
  &lt;script&gt;
  export default {
  data() {
   return {
    map: [],
    markers: null
  };
  },
  computed: {
   events() {
    return this.$store.state.events;
   }
  },
  watch: {
  events(val) {
    this.removeEvents();
    this.addEvents(val);
  }
  },
  methods: {
  addEvents(events) {
    const map = this.map;
    const markers = L.markerClusterGroup();
    const store = this.$store;
  
    events.forEach(event =&gt; {
      let marker = L.marker(e.latlng, { draggable: true })
        .on("click", el =&gt; {
          store.commit("locationsMap_center", e.latlng);
        })
        //.bindPopup(`&lt;b&gt; ${event.id} &lt;/b&gt; ${event.name}`)
        .addTo(this.map);
      markers.addLayer(marker);
    });
  
    map.addLayer(markers);
    this.markers = markers;
  },
  removeEvent() {
    this.map.removeLayer(this.markers);
    this.markers = null;
  }
  },
  mounted() {
  const map = L.map("map", {
    contextmenu: true,
    contextmenuWidth: 140,
    contextmenuItems: [
      {
        text: "Add Event Here",
        callback: this.addEvents
      }
    ]
  }).setView([0, 0], 1);
  
  L.tileLayer("/static/map/{z}/{x}/{y}.png", {
    maxZoom: 4,
    minZoom: 3,
    continuousWorld: false,
    noWrap: true,
    crs: L.CRS.Simple
  }).addTo(map);
  this.map = map;
  }
  };
  &lt;/script&gt;
  </code></pre>