var self = this?

后端 未结 8 1425
失恋的感觉
失恋的感觉 2020-11-22 09:10

Using instance methods as callbacks for event handlers changes the scope of this from \"My instance\" to \"Whatever just called the callback\"

8条回答
  •  栀梦
    栀梦 (楼主)
    2020-11-22 09:46

    Just adding to this that in ES6 because of arrow functions you shouldn't need to do this because they capture the this value.

提交回复
热议问题