有没有一种方法可以在渲染特定视图时隐藏容器项目?

时间:2020-02-24 12:29:57

标签: authentication extjs show-hide

我尝试使用ext js制作现代桌面Web应用程序。该应用程序的主视图有4个子视图:菜单,页眉,页脚和中心视图。我想在显示此登录视图时将其隐藏。但是我不知道该使用哪种技巧。

Ext.define('App.view.auth.Login', {
    extend: 'Ext.Container',
    xtype: 'authlogin',

    controller: 'authlogin',

    cls: 'auth-login',

    layout: {
        type: 'vbox',
        align: 'center',
        pack: 'center'
    },

    items: [{
        cls: 'auth-header',
        html:
            '<span class="logo x-fa fa-circle-o-notch"></span>'+
            '<div class="title">Coworkee</div>'+
            '<div class="caption">Employee directory</div>'
    }, {
        xtype: 'formpanel',
        reference: 'form',
        layout: 'vbox',
        ui: 'auth',

        items: [{
            xtype: 'textfield',
            name: 'username',
            placeholder: 'Username',
            required: true
        }, {
            xtype: 'passwordfield',
            name: 'password',
            placeholder: 'Password',
            required: true
        }, {
            xtype: 'button',
            text: 'LOG IN',
            iconAlign: 'right',
            iconCls: 'x-fa fa-angle-right',
            handler: 'onLoginTap',
            ui: 'action'
        }]
    }, {
        cls: 'auth-footer',
        html:
            '<div>Ext JS example</div>'+
            '<a href="http://www.sencha.com" target="_blank">'+
                '<span class="logo ext ext-sencha"></span>'+
                '<span class="label">Sencha</span>'+
            '</a>'
    }]
});

1 个答案:

答案 0 :(得分:0)

是的,路由是最好的策略,但是如果您不想使用它,则可以创建一个函数,该函数根据用户的登录状态返回布尔值。然后,您可以将该登录状态与任何视图的hidden属性绑定,从而解决问题。

相关问题