Hi guys i been trying to pass props in vue routes so far i was able to achieve this below, but is not what i wanted.
So far this works
route.js
{
path: '/register/',
name: 'register',
component: require('./views/Login').default,
}
home.vue
<router-link tag="li" :to="{ name: 'register', params: { isRegisteringMe: 'true' }}" class="btn btn-green m-top-20 menu-btn" v-show="!isLoggedIn">Register</router-link>
And in register.vue i can console.log(this.$route.params.isRegisteringMe);
which will return true
when i click on Register link.
This is fine but what happen is user wants to type in the url directly website.com/register
this method will not work. So i try several method but still not getting no where when i write this below.
{
path: '/register/:id',
name: 'register',
props: { isRegisteringMe: 'hi props'},
component: require('./views/Login').default,
}
Or
{
path: '/register',
name: 'register',
props: { isRegisteringMe: 'hi'},
params: { isRegisteringMe: 'hi'},
component: require('./views/Login').default,
}
Trust me i tried many different combination but i am still stuck.