我一直在尝试使用以下代码扩展Ext.Panel(在app / view / viewport.js中):
App.views.Viewport = Ext.extend(Ext.Panel, {
fullscreen: true,
initComponent: function() {
App.views.Viewport.superclass.initComponent.apply(this, arguments);
}
});
从(app / app.js)调用此代码:
App = new Ext.Application({
name: 'App',
launch: function() {
this.launched = true;
this.mainLaunch();
},
mainLaunch: function() {
if (!device || !this.launched) {return;}
this.views.viewport = new this.views.Viewport();
}
});
整个工作在桌面上运行得很好,但是当把phonegap(0.9.6)抛入方程式并部署在Android设备上时,我得到以下错误(在LogCat中):
Uncaught TypeError: Cannot read property 'superclass' of undefined at file:///android_asset/www/app/views/viewport.js
我一直在调查这件事几个小时没有任何进展! 非常感谢您的帮助
答案 0 :(得分:2)
Android上的PhoneGap会创建一个名为“app”的对象,它与您的命名空间冲突。将“App”重命名为其他内容,它应该可以正常工作。
请参阅http://www.codesta.com/blog/2011/5/23/sencha-touchphonegap-tips-and-tricks.html