以下函数在this.codesService.getCostCodes()解析之前返回Promise,导致未定义 async getTopParentByChildId(id: string) {parent` results in the same issue });
} getTopParentByChildId()正被另一个异步函数调用,该函数具有相同的问题,即在解析异步调用
);// when referenced outside, it doesnt hold anything. // doc.data() will be undefined:", error); return store; // returns nothing and seems to not notice the assignment.
} 我最初完成了一个简单的然后,我在一个index.js文件中添加了一个回调函
我使用异步函数和axios库发出多个HTTP请求。但是,我并不总是希望返回从我的http请求获取的数据,只有在满足特定条件的情况下。let response = await axios.get(url);
//I only wantgetAllData().then(data => {
//Here is the problem, here I get a