Vuejs2 Vuetifyjs的v-data-table绑定doc对象时出现的问题

Vuejs2 Vuetifyjs的v-data-table绑定doc对象时出现的问题,vuejs2,pouchdb,vuetify.js,Vuejs2,Pouchdb,Vuetify.js,我正在尝试将PockDB文档绑定到v-data-table组件 我的HTML和JS代码如下: 当我获取数据时,应用程序会抛出以下错误: [Vue warn]: Invalid prop: type check failed for prop "items". Expected Array, got Object. found in ---> <VDataTable> <HelloWorld> at src\components\Note\Note

我正在尝试将PockDB文档绑定到v-data-table组件

我的HTML和JS代码如下:

当我获取数据时,应用程序会抛出以下错误:

[Vue warn]: Invalid prop: type check failed for prop "items". Expected Array, got Object.

found in

---> <VDataTable>
       <HelloWorld> at src\components\Note\NotesForm.vue
         <VContent>
           <VApp>
             <App> at src\App.vue
               <Root>
================================================================
[Vue warn]: Error in getter for watcher "someItems": "TypeError: this.items.slice is not a function"

found in

---> <VDataTable>
       <HelloWorld> at src\components\Note\NotesForm.vue
         <VContent>
           <VApp>
             <App> at src\App.vue
               <Root>
====================================================================
TypeError: this.items.slice is not a function
    at VueComponent.filteredItems (vuetify.js:7561)
    at Watcher.get (vue.common.js:3142)
 ............

===================================================================
[Vue warn]: Error in getter for watcher "everyItem": "TypeError: this.items.slice is not a function"

found in

---> <VDataTable>
       <HelloWorld> at src\components\Note\NotesForm.vue
         <VContent>
           <VApp>
             <App> at src\App.vue
               <Root>
======================================================================
TypeError: this.items.slice is not a function
    at VueComponent.filteredItems (vuetify.js:7561)
    at Watcher.get (vue.common.js:3142)
   ...................
[Vue warn]:无效道具:道具“项目”的类型检查失败。应为数组,已获取对象。
发现于
---> 
位于src\components\Note\NotesForm.vue
在src\App.vue
================================================================
[Vue warn]:观察程序“someItems”的getter中出错:“TypeError:this.items.slice不是函数”
发现于
---> 
位于src\components\Note\NotesForm.vue
在src\App.vue
====================================================================
TypeError:this.items.slice不是函数
在VueComponent.filteredItems(vuetify.js:7561)上
在Watcher.get(vue.common.js:3142)
............
===================================================================
[Vue warn]:监视程序“everyItem”的getter出错:“TypeError:this.items.slice不是函数”
发现于
---> 
位于src\components\Note\NotesForm.vue
在src\App.vue
======================================================================
TypeError:this.items.slice不是函数
在VueComponent.filteredItems(vuetify.js:7561)上
在Watcher.get(vue.common.js:3142)
...................
我哪里做错了?请帮忙


TIA:)

经过一些尝试和错误后,我已经解决了这个问题

我从PockDB返回对象中取出文档并将其推送到items数组中

Object.values(t).forEach(function(v) {           
           self.items.push(v.doc);
         });
现在,“items”数组正确绑定到v-data-table并显示记录

修改后的小提琴如下:


谢谢

经过一些尝试和错误后,我已经解决了这个问题

我从PockDB返回对象中取出文档并将其推送到items数组中

Object.values(t).forEach(function(v) {           
           self.items.push(v.doc);
         });
现在,“items”数组正确绑定到v-data-table并显示记录

修改后的小提琴如下:


谢谢

第一行似乎告诉你问题所在。你的代码需要一个数组,而你得到的是一个对象。是的,我知道。。“doc”(由PockDB返回)是一个(JSON)对象数组。。但是,即使我从doc对象中提取单个值并将其推送到“items”数组中,它也不会像预期的那样工作。第一行似乎告诉了您问题所在。你的代码需要一个数组,而你得到的是一个对象。是的,我知道。。“doc”(由PockDB返回)是一个(JSON)对象数组。。但即使我从doc对象中提取单个值并将其推送到“items”数组中,它也不会像预期的那样工作。。