Navigation guard - tell how a route was arrived at
-
Hi, does anyone know if there’s a way to distinguish in beforeRouteUpdate between a route which was arrived at through a router-link (or router.push) and a router.back (or hitting the android back button)?
-
does not seem possible with soly
beforeRouteUpdate
, but you could store a value in for example vuex before you execute: router.push, router.back, ect.Then you’ll get something like this in the vuex:
state: { routeMethod: “router.push”} , -
@dobbel But that means I can’t just use the “to” attribute for list items, I have to manually create handlers for each menu item which calls this.$store.commit(…) and then this.$router.push(…), is that right?
-
correct.