javascript - How do I use Vue.js v-for to iterate over a Number variable? -
for example, have positive integer variable, rating.
the documentation http://vuejs.org/guide/list.html#range-v-for lists using number directly, switching number out variable doesn't work expected.
i doing this:
<i v-for="i in rating" class="fa fa-2x fa-star">{{ rating }}</i>
but unfortunately it's showing once, through ratings value 4. missing in documentation?
i figured out issue was, passing rating value in via property, being passed in string. see non-working example here:
<rating-component value="rating"></rating-component> vs
<rating-component :value="rating"></rating-component"> by switching out value property :value, use literal variable instead of string variable fixed issue.
Comments
Post a Comment