【发布时间】:2020-04-27 08:27:18
【问题描述】:
这是有问题的数据
[
{
"id":1,
"date":"2020-01-02",
"start_time":"11:32:25",
"end_time":"11:32:26",
"editions":null,
"coordinates":null,
"ranking":null,
"user_id":3,
"instructor_id":2,
"course_id":2,
"package_id":null,
"location_id":3,
"created_at":null,
"updated_at":null,
"student_schedules":[
{
"id":1,
"student_schedule_id":1,
"calification":75,
"approved":0
}
],
}
]
我正在尝试在student_schedules 中进行校准。我尝试过以下操作,history 是整个数据
history.student_schedules['calification']
history.student_schedules.calification
这不起作用并给我错误
TypeError:无法读取未定义的属性“校准”
[Vue 警告]:渲染错误:“TypeError: Cannot read property 'calification' of undefined”
我不知道为什么会出现这些错误,数据显然在那里。
如何访问这些数据?
【问题讨论】:
-
这是一个数组,因此您需要在第一个位置访问它,例如
history[0].student_schedules[0].calification;
标签: javascript laravel vue.js