I have a vue.js app.
I have vuetify tabs. 4 of them.
I have one component which has those 4 tabs in it. and each of those tabs contain the same component called leafletmap and each of 4 tabs pass different information to that leafletmap component. so leafletmap component is written 4 times in that one component.
leafletmap component's mounted() hook initializes the map and also uses prop data to show those points on map. I also use fitbounds.
What happens: When loading the page, the first tab shows everything correctly. fitBounds work perfectly, but if I change the tab, fitBounds don't seem to work and map is shown as fitBounds() shows whole earth (if map is first hidden and then shown) something like this. I don't know why this happens.
let bounds = new L.LatLngBounds();
var loc = new L.LatLng(parseFloat(newVal[key][i].latitude), parseFloat(newVal[key][i].longitude));
var marker = new L.Marker(loc, {
icon:motionIcon,
zIndexOffset: runningIndex,
});
bounds.extend(loc);
this.map.fitBounds(bounds, {
});