【发布时间】:2019-04-24 15:55:25
【问题描述】:
我正在尝试像这样使用 ListView 元素:
<ListView for="reservacion in reservaciones" @itemTap="onItemTap">
<v-template>
<Label :text="reservacion.fecha_reservacion" />
</v-template>
</ListView>
但我收到以下错误:
[Vue 警告]:无效的道具:道具“项目”的类型检查失败。期望数组,得到对象。
在我的 axios 调用中,我绑定了 this.reservaciones = response.data,其中 data 是一个对象数组:
[{
"id":25,
"folio":"181019165089",
"jugador_id":3,
"fecha_reservacion":"2018-10-19",
"hora_reservacion":"07:00:00",
"hoyo":1,
"user_id":3,
"status":0,
"tipo_reservacion":3,
"created_at":"2018-10-19 16:50:17",
"updated_at":"2018-10-22 10:49:26"
},{
"id":32,
"folio":"181019170560",
"jugador_id":3,
"fecha_reservacion":"2018-10-19",
"hora_reservacion":"07:10:00",
"hoyo":10,
"user_id":3,
"status":0,
"tipo_reservacion":3,
"created_at":"2018-10-19 17:05:28",
"updated_at":"2018-10-22 10:49:57"
}]
如何将响应中的对象数组“转换”为数组数组?这样我就可以将它绑定到列表视图。
【问题讨论】:
标签: listview vue.js nativescript