Vuejs Next

Posted on  by admin

Not the answer you're looking for? Browse other questions tagged vue.jsparametersvuejs2vue-router or ask your own question.

  • Modified2 years, 1 month ago. I want to pass the last route into my router when I'm in /login to redirect the user when is logged to desired route. So the user go to /payment I redirect to /login and when the authentication is ok I want to redirect the user to payement.

  • Here is my router.js :. So I set some console.log and I got this :. if I go directly to /login, Output :. Then if I go to /payment, Output :. So now when I go in my login component and I use this.$route.params.nextUrl it's undefined.

  • The next() parameter doesn't exist and I don't know why. What I'm doing wrong ? 77 gold badges3838 silver badges8888 bronze badges. 8888 bronze badges.

  • It looks like you're confusing two different mechanisms: params and query. Params have to be integral to the url, like /user/:id while query params are appended automatically.

  • Related reading: https://router.vuejs.org/api/#route-object-properties. Tristan SheltonTristan Shelton. Tristan's approach above is the best when passing a url as a parameter.

  • However, in normal cases we're passing something like an id so you can use this:. Add the replace option to prevent the navigation from appearing in the history:.

  • I'm using vue-router 3.1.6. 11 gold badge2929 silver badges2626 bronze badges.

  • 2626 bronze badges.

  • The moment I used Nuxt for the first time I felt in love with it. Apart from its scalability, performance and developer experience, the team behind of it is also fantastic. Thanks for developing such a great framework and making our lives much easier!