title: How to handle on browser back button click event in Vuejs
body: <p>In Vue component, I want to handle on browser back event like this:</p>
  
  <pre><code>mounted() {
    if ([browser back]) {
      console.log("browser back button clicked")
    } else {
      console.log("stay here")
    }
  }
  
  </code></pre>
  
  <p>To handle browser back event, I found <code>window.onpopstate</code> function but I don't know how to put it inside the <code>if</code> statement. </p>
  
  <p>Can you tell me what should I do on this case? Thank you!</p>