Reputation: 3569
How can I use the variable in router-link ?
<Col
span="8"
v-for="(item,index) in this.data"
>
<router-link to='/home/workpanel/true/ + item.name'>
there it can not convert the item.name to the value, it is just the string:
'/home/workpanel/true/ + item.name'
how can I use the variable in the router-link
's to
?
if I click the link, the browser shows:
http://localhost:8080/home/workpanel/true/%20+%20item.name
Upvotes: 1
Views: 2205
Reputation: 4657
Just add :
before to
attribute. In this way you can use javascript syntax.
<router-link :to="'/home/workpanel/true/' + item.name">
Upvotes: 2