这是一种解决方法,显然我不应该首先使用它。但是当我调试代码时 - “this”等于undefined !!!
public loadByIds(raw:string):Promise<any> {
const _this = this;
this.ids = raw.split('\n');
return this.api.getStones(this.ids).then( results => {
_this.problems.notFound = results.notFound;
_this.problems.removed = results.removed;
(results.accounts as Array<any>).forEach( (account:AccountFlatModel) => {
_this.accounts.push(account);
});
});
}