您有以下选择:
1)使用 箭头 功能:
class ClassName { // ... aMethod(){ let aFun = () => { this.dir;// ACCESS to class reference of this } }}2)或
bind()方法:
class ClassName { // ... aMethod(){ var aFun = function() { this.dir;// ACCESS to class reference of this }.bind(this); }}3)存储
this在专用变量中:
class ClassName { // ... aMethod(){ var self = this; function aFun() { self.dir;// ACCESS to class reference of this } }}本文介绍有关
thisJavascript中的和箭头功能的必要详细信息。



