如果您不需要promise的上下文,请使用箭头函数
class Group { constructor() {} foo() { // 'this' references the class instance here console.log(this.myProp); => 'my value' // could do this 'var self = this' but do i need to add this code to every method that returns a promise? return Q.promise((resolve, reject) => { // 'this' references the class instance here }); } }