我已通过此sample创建了一个面板,它在tools
配置下有2个项目。这两个项目都有自己的功能,通过ViewController
绑定。 refresh
项的功能运行良好,但gear
项的功能在下面给出了这个错误;
Uncaught TypeError: Cannot read property 'scope' of undefined
at constructor.addListener (Observable.js?_dc=1516015518102:1135)
at constructor (Observable.js?_dc=1516015518102:403)
at constructor.beforeInitConfig (Component.js?_dc=1516015518101:2261)
at Ext.Configurator.configure (Configurator.js?_dc=1516015518102:558)
at constructor.initConfig (Base.js?_dc=1516015518101:1554)
at constructor (Component.js?_dc=1516015518101:2137)
at new constructor (Class.js?_dc=1516015518101:42)
at Object.widget (ClassManager.js?_dc=1516015518101:1638)
at constructor.create (ComponentManager.js?_dc=1516015518102:76)
at constructor.lookupComponent (Container.js?_dc=1516015518101:1564)
我已将视图类从app
文件夹移动到classic
文件夹,但ViewController
类保留在app
文件夹中,所以我猜错误是通过{{ 1}}符号。我应该如何在ViewController中声明它?
this
更新
我为视图创建了weatherWindow: function () {
var win = this.lookupReference('weatherWindow');
if (!win) {
win = new MyApp.view.weather.SettingsWindow();
this.getView().add(win);
}
win.show();
},
但仍然出现ViewController
错误!
scope
答案 0 :(得分:0)
我找到了解决此错误的方法。在窗口类中创建了一个函数并返回它;
getSettingsItems: function () {
var me = this;
var settingsItems = [
// whole items listed here!
];
return settingsItems;
},