0
votes

I'm facing a weird problem with the Programmatic Navigation of VueJS 2.0 router because I cannot receive as props the params I sent from X component to Y.

I have this route in my routes.js

{
  path: '/email-verification',
  name: 'email-verification',
  component: EmailVerification,
  props: true,
},

So after I perform the form submission in X I have to navigate to the Y component and to do that I have the following code:

router.push({ path: 'email-verification', params: { email: this.email } });

The navigation works but I'm not receiving the email param in the Y component.

I'm trying to get the props using this:

export default {
  name: 'login',
  props: ['email'],
}

But when I try to access to the email prop, is always undefined

Do you have any idea?

2

2 Answers

0
votes

As I found in the docs, you should only use "props" instead of "params"

There is a line

props: { default: true, sidebar: false }
0
votes

When you dinamically define your route, you have to put its "name" instead its "path", so your sentence should have been:

router.push({ name: 'email-verification', params: { email: this.email } });