[Vuejs]-How to detect if user pressed back button with vue router?

0👍

im not completely sure i got you, but if you want to run somthing every time the url changes, vue router navigation guards can help you a lot (in router.beforeEach or router.afterEach for example:

router.beforeEach((to, from, next) => {
  // everything you right here will get excuted whenever the route changes
})

)

to change the route, you probably know you can use $router.push(options) more about it here: https://router.vuejs.org/guide/essentials/navigation.html

Leave a comment