使用异步等待获取数据加载

我尝试使用 async-await 获取 typescript vue 3 上的数据,但是当数据未定义时(或在函数调用工作之前),此函数已经控制台

private async exportDataOrder() {
    await this.getDataExport()                          // function call
    let data = await this.controller.exportOrderData    // result function
    if (data) {
      console.log(data, 'dari vue')
      console.log('waiting')
    }
}

以上是使用异步等待获取数据加载的全部内容。
THE END
分享
二维码
< <上一篇
下一篇>>