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

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

python Tkinter Capturing keyboard events save as one single string -

sql server - Why does Linq-to-SQL add unnecessary COUNT()? -