我尝试使用 vueJS v-for 函数循环遍历多维 json_object。
但我收到以下错误:
[Vue 警告]:渲染函数中的错误:“TypeError:无法读取属性 'id' of null”
我的代码如下所示:
<tr v-for="timeblock in responseAPI">
<td>
{{timeblock.time}}
</td>
<td v-for="value in timeblock.appointment">
{{value.id}}
</td>
<td>
{{timeblock.break}}
</td>
<td>
{{timeblock.scheduled}}
</td>
<td>
{{timeblock.text}}
</td>
</tr>
我的 json_object 是这样的:
[
{
"time": "09:00",
"break": null,
"scheduled": "Stoel 1",
"appointment": {
"id": 1,
"patient_id": 1,
"chair_id": 1,
"date": "2017-05-10",
"time": "09:00:00",
"duration": 30,
"treatment_type": "Controle",
"created_at": null,
"updated_at": null
},
"text": null
},
{
"time": "09:30",
"break": null,
"scheduled": "Stoel 1",
"appointment": {
"id": 2,
"patient_id": 2,
"chair_id": 1,
"date": "2017-05-10",
"time": "09:30:00",
"duration": 30,
"treatment_type": "Controle ",
"created_at": null,
"updated_at": null
},
"text": null
} ]