Vue中的async和await【reggie_take_out】

https://blog.csdn.net/G_Z_X/article/details/123535642
https://gitee.com/yub4by/my-reggie-take-out
resources/backend/page/food/list.html

methods: {
          async init () {
            const params = {
              page: this.page,
              pageSize: this.pageSize,
              name: this.input ? this.input : undefined
            }
            await getDishPage(params).then(res => {
              if (String(res.code) === '1') {
                this.tableData = res.data.records || []
                this.counts = res.data.total
              }
            }).catch(err => {
              this.$message.error('请求出错了:' + err)
            })
          },
}
posted @ 2023-01-14 09:06  yub4by  阅读(11)  评论(0编辑  收藏  举报