I have a vue.js template that has a todo prop. I want to dynamically set the id value of each element. This what I have tried so far, is something like this possible and if not what are some other options?
<canvas class="canvas" id="cv`${{todo.id}}`" width="500" height="700"></canvas>
This should work.
:id="`cv${todo.id}`"
or
v-bind:id="`cv${todo.id}`"
Or do it the old-school way if the browser doesn't support string interpolation:
:id="'cv' + todo.id"
This is essentially a duplicate but I couldn't determine how to escape the backticks in a comment!
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