0

Im trying to start my app with a sample url like this one : https://www.example.com/?foo=bar

I tried the following in my Vue Router as explained here (https://router.vuejs.org/guide/essentials/passing-props.html#function-mode) :

function dynamicPropsFn (route) {
  console.log(route.query.foo) // undefined ??
  return {
    foo: route.query.foo
  }
}

//...
{
  path: "/",
  name: "landing",
  meta : {layout : 'landing'},
  component : Landing,
  props: dynamicPropsFn
},//...

My issue is that the query string parameter is always undefined ...

Any help would be appreciated!

1 Answer 1

1

I have created the plunker with your function and its working fine for me.

[https://codepen.io/anon/pen/moePxK]

The function is executed when the user clicks on the router.

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

1 Comment

I was missing the " mode:'history' " in my Router, thanks for your help !

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.