I'm not able to use
this.$route.params
route.params
router.params
how do I get the params of $route in my actions?
to get the value of the id route parameter with this. $route.params.id with the options API. We call useRoute to return the route object and then we get the value of the id route parameter with route.params.id .
To listen for route change events with Vue. js and Vue Router, we can watch the $route object in our component. to watch the $route in our component. We set deep to true to watch for all changes in the $route object's contents.
in your actions.js or store.js
import router from 'path/to/router'
console.log(router.currentRoute.params)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With