cocos create 单例的写法

我写了一个类A用来挂载脚本,即 cc.class
statics写了一个方法
export var myClass = cc.class(
statics:{
getslef:function() {
return this;
}

fff:function(){
}
}

)
在别的js中导入A, import * as A from ‘./A’,导入的目的为了使用fff 方法
在某个方法里调用 A.myClass.getself() 并不能达到我单例的目的,请问这个该怎么写获取到myclass 以调用到fff方法

括号没写对,fff方法并不在 statics 内

不能直接return this啊,
statics:{ _instance: null, getslef:function() { if (this._instance === null){ this._instance = new myClass(); } return this._instance; }

1赞

你好啊 贾队长