与EcmaScript有关的问题:
const firstArg = 'myArg';
this._myFunction(firstArg)
.then((asyncResponse) => this._secondMethod(asyncResponse))
.then((asyncSecondResponse, asyncResponse) =>
this._thirdMethod(asyncSecondResponse, asyncResponse))
.then(() => this._lastMethod());问题是:如何传递给_thirdMethod 2参数(一个来自this._secondMethod(asyncResponse)),给出一个参数,第二个只是前一个asyncResponse) --我不想在_secondMethod(asyncResponse)中定义它来返回这两个参数,只想在我前面写的管道中这样做
它有语法吗?
发布于 2018-10-02 11:13:10
您还可以嵌套第二个“然后”以将第一个asyncResponse保留在作用域中。
this._myFunction(firstArg)
.then((asyncResponse) => this._secondMethod(asyncResponse)
.then((asyncSecondResponse) => this._thirdMethod(asyncSecondResponse, asyncResponse)))
.then(() => this._lastMethod());
}https://stackoverflow.com/questions/52606932
复制相似问题