allw
51
11
Vue

Accessing Array of Array

Posted 3 months ago by allw

I have returned an array of student objects to Vue, inside these objects are results arrays.

How do I attach a v-model to a specific one of these items depending on which 'paper' is being looped out? I know I cannot do the following but how would I do it?

<td v-for="(paper, key) in this.papers" :key="key"><input type="text" class="text-center" :id="(key) + '_' + (index +1)" v-model="student.results['paper_id' = paper.id].mark">
</td>

Even tried

<td v-for="(paper, key) in this.papers" :key="key"><input type="text" class="text-center" :id="(key) + '_' + (index +1)" v-model="student.results[key].mark">
</td>

Which also doesn't seem to work...

thanks!

Please sign in or create an account to participate in this conversation.

Reply to

Use Markdown with GitHub-flavored code blocks.