题目描述
前辈们,在使用vuejs写前端的时候遇到一个很奇怪的问题,在table中使用v-for时,如果我不在<thead>上面插入{{info.title}},代码可以正常运行,但只要插入这个代码,就会提示info找不到,请问前辈们,这是什么原因呢?
相关代码
<table class="layui-table" v-for="(info, index) in GsgjInfos">
{{info.title}} //有问题的代码
<thead>
<tr>
<th>序号</th>
<th>姓名</th>
<th>性别</th>
</tr>
</thead>
<tbody>
<tr v-for="(zhusu, index) in JSON.parse(info.baseZhuSus)">
<td>{{index + 1}}</td>
<td>{{zhusu.xm}}</td>
<td>{{zhusu.xb}}</td>
</tr>
</tbody>
</table>
你加key了吗,两个v-for在一起要保证他们的key不一样,而且你没有加key