I load a component inside my vuejs page which is only visible after a certain button is pressed. But if the usere uses not the BACK BUTTON from the BROWSER, it doen't close my component and maked the "original" component visible, it jumes back to the page before.
I need to prevent this behaviour. What I want to do is:
- Stop the "GO BACK" action
- Run a function instead
I tried the following already and it runs the function when someone clicks the "BACK BUTTON" in the browser but it doesn't prevent the "GO BACK ACTION".
mounted() {
window.onpopstate = () => {
this.closeDetailedView()
}
},
The closeDetailedView function does the folowing:
closeDetailedView() {
this.$emit('closeDetailedView')
},
Can someone help me?
thanks