1

I cannot figure out the correct syntax for passing dynamic param data. I have tried a couple of variations, but I would assume I could inject someValue via:

<router-link :to="{ name: 'Foo', params:{ bar: ${someValue} } }">

However, I keep getting compiler errors.

2
  • 1
    i think you should do it like <router-link :to="{ name: 'Foo', params:{ bar:someValue} }"> by assuming that someValue is a dynamic property Commented Dec 26, 2018 at 20:19
  • 1
    Yep, you're correct. Thought I already tried that. :) Commented Dec 26, 2018 at 20:35

1 Answer 1

2

You could pass any dynamic property via router-link params like :

 <router-link :to="{ name: 'Foo', params:{ bar:someValue} }">

someValue sould be a data object item or computed property, and if you want to pass a value returned with a method you could do it like :

<router-link :to="{ name: 'Foo', params:{ bar:someMethod()} }">
Sign up to request clarification or add additional context in comments.

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.