嗨,我是反应 js 的新手,我正在调用 getItem 函数并将响应推送到一个数组并返回该数组,但是在我返回之前我得到了空数组
private _LoadExpenses() {
const items: IExpense[] = [];
this._expensesDataProvider.getItems().then((expenses: IExpense[]) => {
expenses.forEach(element => {
items.push({SGDDAppDate:element.SGDDAppDate,ExpenseCategory:element.ExpenseCategory,ExpenseType1:element.ExpenseType1});
});
return expenses;
});
//console.log(items)
return items;
}