[Vuejs]-Why does it make api calls from other routes if I'm not already in it, Vue Router

1👍

this.$bus.$on(...) creates a new event listener for every route you visit. since $bus is a global object, these event listeners don’t get removed just because you navigate away from a route. You need to make sure before you navigate away that you remove the old listener in the destroyed lifecycle hook of the component.

destroyed() {
    this.$bus.$off('reloadData');
}
👤yoduh

Leave a comment