[Vuejs]-Vuejs component doesn't always show fetched data

0👍

I’ve had a similar issue, it was caused by duplicate (or absent) keys on the v-for elements. You might fix the code by simply adding :key attribute:

<optgroup v-for="category in subjects" :key="category.id" :label="category.name" :data-catID="category.id">
    <option :value="subject.id" v-for="subject in category.subjects" :key="subject.id">{{ subject.name }}</option>
</optgroup>

Leave a comment