I have functions which is redirecting user in 4 seconds, but I need to pass props somehow:
setTimeout(() => {
clearInterval(intervalId)
this.$router.push({ path: `/${this.$store.state.locale}/my-cart` })
}, 4000)
I was trying to do something like that:
this.$router.push({ name: '/${this.$store.state.locale}/my-cart', params: {step: '2'} })
This didn't work, this route redirects on main page, so, how can I do that?
CodePudding user response:
this.$router.push({ path: '/${this.$store.state.locale}/my-cart', params: {step: '2' }})
please change the name
and replace path
into code
CodePudding user response:
If you want to use url to declare for a path. You need to change "name" to "path".
this.$router.push({ path: '/${this.$store.state.locale}/my-cart', params: {step: '2'} })
Else you want to use name, you can pass value of name attribute that define in route.js file instead pass url.
this.$router.push({ name: 'namePath', params: {step: '2'} })