When trying to dispatch an action after updating the route using this.$router
, the action uses the previous route parameters instead of using the current route parameters.
Suppose I want to move to the /home
and currently, I am on /about
and in the store action called
I want to access the route name, but after pushing the new route and then calling the action, it is using the previous route only and not the updated one.
this.$router.push('/home', this.$store.dispatch('called'))
Also, I tried using this.$router.push('/home').then(this.$store.dispatch('called'))
, but it gives undefined error.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…