为什么
this最终会
undefined出现这种情况?
因为您传递的是函数,而不是方法绑定的实例。对于通用解决方案:
….then(this.method2.bind(this))… // ES5 .bind() Function method….then((r) => this.method2(r))… // ES6 arrow function
但是,Bluebird确实提供了另一种方法来调用函数:
this.service.serviceMethod(args) .bind(this) .then(this.method2) .catch(onRejected);



