小编jac*_*jac的帖子

[Vue 警告]:无效的道具:道具“物品”的类型检查失败。预期数组,得到 Promise

我是整个节点技术堆栈的新手,并试图通过承担一个项目来提高自己。在这一点上,我已经取得了一定的成功(可能是偶然的),但我目前陷入困境。我的客户端正在使用“axios、vue、vue-router、vuetify”和其他一些。服务器端代码是“axios、bluebird、sequelize 和 sqlite3”。

我的问题如下,我试图通过进行以下函数调用来填充“v-data-table”:

<v-data-table
:headers="task_headers"
:items="getTasks(props.item.upgrade_id)"
hide-actions
item-key="task_id"
>
Run Code Online (Sandbox Code Playgroud)

我的函数如下所示:

  methods: {
      async getTasks (id) {
      try {
        console.log('JAC in getTask value of id is: ', id)
        this.tasks = await TasksService.show(id)
        console.log('JAC value of this.tasks is typeof: ', typeof this.tasks)
        console.log('JAC value of this.tasks values are: ', Object.values(this.tasks))
        console.log('JAC value of this.tasks keys are: ', Object.keys(this.tasks))
        return this.tasks.data
      } catch (err) {
        console.log(err)
      }
   }
Run Code Online (Sandbox Code Playgroud)

我的调试消息产生以下输出:

    JAC value of this.tasks is typeof:  object

    JAC value of this.tasks values are: …
Run Code Online (Sandbox Code Playgroud)

promise vue.js axios

6
推荐指数
1
解决办法
2万
查看次数

标签 统计

axios ×1

promise ×1

vue.js ×1