Dhr*_*ewn 6 asynchronous async-await typescript vuejs3
我尝试使用 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')
}
}
Run Code Online (Sandbox Code Playgroud)
假设这exportOrderData是一个异步函数,您忘记了()实际调用您的函数。
let data = await this.controller.exportOrderData()
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
39 次 |
| 最近记录: |