title: custom event still firing after leaving the components vuejs 2
body: <p>I'm working on a spa project using vue.js. In one component i'm sending ajax request after a while. I"m using vue-router to navigate. when i leaving the route and entering to another component, the ajax request still executing. How do i prevent/destroy the event executing? Here is my code example:</p>
  
  <pre><code>    export default {
          data() {
              return {
              };
          },
          methods: {
              onLoad() {
                  setInterval(function(){
                      //sending ajax request
                  }, 5000);
              },
          },
          mounted() {
              this.onLoad();
          },
      }
  </code></pre>