I'm running Vue.js and have a for
-loop and a trying to generate links with href
like /car/xyz
:
<router-link to="/car/+ car.id">{{ car.id }}</router-link>
But it fails to render correctly, as I guess I'm appending the car.id
wrong to the to
value?
Just replace to
with :to
and format value as a string:
<router-link :to="'/car/' + car.id">{{ car.id }}</router-link>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With