Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Pass dynamic ID to router_link - Vue.js

I'm trying to pass a dynamic ID to the router_link but I can't seem to figure out how to do it.

This is what I'm currently trying:

<router-link to="/leagues/{{props.item.id}}">League</router_link>

That props.item.id equals 10 but this syntax isn't correct. I'm also referencing the documentation but I can't seem to find a straightforward answer for this. Any help would be great.

like image 326
Bitwise Avatar asked Oct 27 '25 10:10

Bitwise


1 Answers

Ok so passing a dynamic ID to vue-router should look like this:

<router-link :to="{name: 'League', params: {id: props.item.id}}">League</router_link>
like image 200
Bitwise Avatar answered Oct 28 '25 22:10

Bitwise



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!