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