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> 

here's working fiddle.


Comments

Popular posts from this blog

python Tkinter Capturing keyboard events save as one single string -

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

javascript - Z-index in d3.js -