1👍
Pass the value as an integer
by adding binding sign :
to the passed prop, because it’s a string
, and has only one length, that’s why it’s not iterating.
<div>
<ratings :rating="4"></ratings>
</div>
If the value is coming from server or other place, convert the value into loop, like this:
<i class="fa fa-star text-warning fa-2x" v-for="r in parseInt(rating)" :key="r"></i>
Source:stackexchange.com