Answer the question
In order to leave comments, you need to log in
How to use v-for with a simple range?
how to properly use v-for="n in 10" rendering given that vue requires the key attribute to be specified
quote from the docs In 2.2.0+, when using v-for with a component, a key is now required.
I can't figure out what to bind the key attribute to. Options with index not working asks to use real elements:
" cannot be keyed. Place the key on real elements instead."
Answer the question
In order to leave comments, you need to log in
Never had any design issues.
<div v-for="(item, index) in items" :key="index">
...
</div>
<template> cannot be keyed. Place the key on real elements instead.
<form action="" class="form-star">
<template
v-for="(num, index) in 5"
v-bind:key="index">
<input type="radio" :id="'star' + (5 - num)" name="rating" :value="5 - num"/>
<label class = "full" :for="'star' + (5 - num)"></label>
</template>
</form>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question