vue.js - VueJS use v-for variable as attribute value -
i have iterative loop using v-for
on array of objects renders html li
item
<li class="block" v-for="(section, key) in sectiondetails"> <a href="#" tabindex="{{ key }}">item {{ key }}</a> </li>
the problem here key
in tabindex
attribute not being rendered, being rendered {{ key }}
.
how can value of key
used tabindex
? i've tried, :tabindex
gives me javascript error.
interpolation within attributes not valid in vue v2.
you need bind tabindex
attribute key
so:
<a href="#" :tabindex="key">item {{ key }}</a>
Comments
Post a Comment