@pockit 写道:
关于 cocos 中 super 的一个很神奇的问题. 其它代码保持不变, 将 this.super(); 改为 this['super']() 即运行时报错: TypeError: this.super is not a function at r.onLoad, 详细代码如下, 请各位大佬赐教.
LoadingManager: [function (e, t, n) { "use strict"; cc._RF.push(t, "xxxxxxxxxxxxxx", "LoadingManager"), cc.Class({ extends: e("ModuleBase"), onLoad: function onLoad() { this._super(); //ok //this['_super'](); //error: TypeError: this._super is not a function at r.onLoad }, init: function init() { this._super(), this.smallLoadingUIInfo = { name: "loading/smallloading", layer: UILayer.Tip }, UIManager.registerUIInfo(this.smallLoadingUIInfo); }, addEvent: function addEvent() { this._super(); }, openSmallLoading: function openSmallLoading() { var e = this, t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : 0;UIManager.openUIWithInfo(this.smallLoadingUIInfo, function () { e.emit("setSmallLoadingType", t); }); }, closeSmallLoading: function closeSmallLoading() { UIManager.closeUIWithInfo(this.smallLoadingUIInfo); } }), cc._RF.pop(); }, { ModuleBase: "ModuleBase" }]
帖子: 1
参与者: 1