I have created a leaflet map with vue.js. I have a method named 'showSubmit, which is to be called at leaflet marker moveend event. This is what I am doing:
this.map.markers.user.on("moveend", function(e) {
this.showSubmit(e);
});
However, this call is showing error, as 'this' within the function refers to the leaflet map instance and not the vue instance. As a workaround, I have declared a variable, like this:
var $this = this;
this.map.markers.user.on("moveend", function(e) {
$this.showSubmit(e, $this);
});
Although this works, but I want to avoid this approach. How can I access the vue component from within leaflet map instance?