0

My '/' path redirect to '/loading' and I need to pass props like mysite/?demo=true and then that prop pass to the component attached to '/loading'

this is the router config

{
  path: '/',
  redirect: '/loading',
},
{
  path: '/loading',
  component: Loading
},

2 Answers 2

2

Do:

    {
      path: '/',
      redirect: { path: '/loading', params: { default: true, demo: true } }
    },
    {
      path: '/loading',
      component: Loading
    },

And in your Loading component, you define a prop called demo, like:

props: {
  demo: Boolean,
}

Then you will be able to access this.demo and read true, wich is the value passed via route.

Sign up to request clarification or add additional context in comments.

Comments

1

Building up on Mathew's solution, to access the route parameter, you could do this.$route.params.demo

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.