ExtJS lookupReference不工作

ExtJS lookupReference不工作,extjs,extjs6,Extjs,Extjs6,我尝试在ViewController中使用lookReference,但无法获取元素 以下是我的看法: Ext.define('MyApp.view.main.Main', { extend: 'Ext.container.Container', xtype: 'app-main', requires: [ 'Ext.layout.container.Card', 'Ext.layout.container.Border',

我尝试在ViewController中使用lookReference,但无法获取元素

以下是我的看法:

Ext.define('MyApp.view.main.Main', {
    extend: 'Ext.container.Container',
    xtype: 'app-main',
    requires: [
        'Ext.layout.container.Card',
        'Ext.layout.container.Border',
        'Ext.layout.container.Accordion',
        'Ext.form.Label',
        'MyApp.view.security.LoginForm'
    ],

    controller: 'main',
    reference: 'appmain',


    items: [{xtype: 'loginform', height: 330}]
});
我的LoginForm视图是:

Ext.define('MyApp.view.security.LoginForm', {
    extend: 'Ext.form.Panel'
    title: 'Access',
    items: [
    {
        name: 'userName',
        fieldLabel: "User Name"
    }, {
        inputType: 'password',
        name: 'password',
        fieldLabel: "Password"
    }],
    buttons: [{
        text: 'Log in',
        listeners: {
            click: 'onLoginClick'
        }

    }]
});
这是我的ViewController:

Ext.define('SoftHuman.view.main.MainController', {
    extend: 'Ext.app.ViewController',

    alias: 'controller.main',

    onLoginClick: function(button, e, options) {
        var me = this;

        // show application layout
        var main = me.lookupReference('appmain');

        // HERE main IS NULL... WHY?
    }
});
知道我做错了什么吗


引用存储在当前引用之上的结构(组件/控制器)上。在具有控制器的组件上放置引用是没有意义的,因为它已经可以通过
this.getView()
访问