我正在使用nativescript-plugin-firebase插件和以下功能从firebase获取数据并将其显示在listview组件中。但是,它正在下载一个对象,我认为listview需要一个数组。我看了网上的每个论坛帖子,却想不出如何正确地将此对象重新格式化为listview所需的格式。使用vuefire for web,这非常容易,但是我无法通过此组件来解决。任何帮助将非常感激。
我尝试了以下方法:
//Here is my listview component:
<ListView class="list-group" for="getWod in getWods" @itemTap="onItemTap"
style="height:1250px">
<v-template>
<FlexboxLayout flexDirection="row" class="list-group-item">
<Label :text="getWod.workoutType" class="list-group-item-heading"
style="width: 60%" />
</FlexboxLayout>
</v-template>
</ListView>
//Here is my call to the API (when I call this function, I set the returned value to "this.getWods")
fetchRequestForGettingData(currentDate1)
{ return firebase.getValue('/wods')
.then(result => { return result; })
.catch(error => console.log("Error: " + error)); }
//Here is what is returned by my function:
key: 'wods', value:
{ '-LWcIjtZGo-arGiWjWJd':
{ weight: 'testing123', workoutType: 'testing123', time: 'testing123', edit: false, reps: 'testing123', date: '01-02-2019', timeCap: 'testing123', workout: 'testing123', description: 'testing123', name: 'testing123' },
'-LWjCMG-jNDnEudppl9J':
{ weight: 'testing123', workoutType: 'testing123', time: 'testing123', edit: false, reps: 'testing12332', date: '02-01-2019', timeCap: 'testing123', workout: '-LWU4DWJWVJxWkDSZYw9', description: 'testing123', name: 'testing123' },
'-LWjEtBwIJDPHK43hVjK':
{ weight: 'testing123', workoutType: 'testing123', time: 'testing123', edit: false, reps: 'testing12332', date: '20-01-2019', timeCap: 'testing123', workout: '-LWc289<…>
我的预期输出是与listview组件兼容的对象/数组。