ExtJS: Uncaught TypeError: Cannot read property 'scope' of undefined

ExtJS: Uncaught TypeError: Cannot read property 'scope' of undefined

我通过这个 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)

我已将视图 class 从 app 文件夹移动到 classic 文件夹,但 ViewController class 留在 app 文件夹中,所以我猜这个错误是通过 this 表示法引起的。我应该如何在 ViewController 内声明它?

weatherWindow: function () {
        var win = this.lookupReference('weatherWindow');

        if (!win) {
            win = new MyApp.view.weather.SettingsWindow();
            this.getView().add(win);
        }

        win.show();
    },

更新 我已经为视图创建了 ViewController,但仍然出现 scope 错误!

Ext.define('MyApp.view.dash.WeatherView', {
    extend: 'Ext.panel.Panel',
    xtype: 'weatherview',

    requires: [
        'MyApp.view.dash.WeatherViewVC',

    ],

    controller: 'weatherView',

//and..
Ext.define('MyApp.view.dash.WeatherViewVC', {
    extend: 'Ext.app.ViewController',
    alias: 'controller.weatherView',

    requires: [],

    weatherWindow: function () {
        debugger;

        var win = this.lookupReference('settingsWindow');

        if (!win) {
            win = new MyApp.view.weather.SettingsWindow();
            this.getView().add(win);
        }

        win.show();
    },

我找到了解决此错误的方法。在 window class 和 return 中创建了一个函数;

getSettingsItems: function () {
    var me = this;

    var settingsItems = [
        // whole items listed here!
    ];

    return settingsItems;
},