Extjs 为什么我必须在Sencha上设置维度?

Extjs 为什么我必须在Sencha上设置维度?,extjs,Extjs,}) 为什么我需要在图像和字段集上设置宽度和高度? 如果我没有,它将不会显示。 我相信每次为每个组件设置宽度和高度都不是一个好的做法,对吗 谢谢当我在Sencha Touch中定位元素时,它也会在Ext.js中工作,我总是尝试使用flex属性。相对定位并不总是一种选择,但在大多数情况下,它会做得很好 Ext.define('CCApp.view.LoginFormPanel', { extend: 'Ext.form.Panel', alias: 'widget.loginformpanel',

})

为什么我需要在图像和字段集上设置宽度和高度? 如果我没有,它将不会显示。 我相信每次为每个组件设置宽度和高度都不是一个好的做法,对吗


谢谢

当我在Sencha Touch中定位元素时,它也会在Ext.js中工作,我总是尝试使用flex属性。相对定位并不总是一种选择,但在大多数情况下,它会做得很好

Ext.define('CCApp.view.LoginFormPanel', {
extend: 'Ext.form.Panel',
alias: 'widget.loginformpanel',
config: {
    title: 'Login',
    layout: {
        type: 'vbox',
        pack: 'center',
        align: 'center'
    },      
    items: [
        {
            xtype: 'image',
            src: '/CCApp/img/lock.png',
            width: 100,
            height: 100
        },                  
        {
            xtype: 'fieldset',
            height: 100,
            width: 800,
            items: [
                {
                    xtype: 'textfield',
                    label: 'Username',
                    placeHolder: 'Username',
                    itemId: 'userNameTextField',
                    name: 'userNameTextField',
                    required: true                          
                },
                {
                    xtype: 'passwordfield',
                    label: 'Password',
                    xtype: 'passwordfield',
                    placeHolder: 'Password',
                    itemId: 'passwordTextField',
                    name: 'passwordTextField',
                    required: true       
                }
            ]
        },                         
        {
            xtype: 'button',
            itemId: 'loginButton',
            width: 100,
            text: 'Login'
        }          

    ],
    listeners: [
        {
            fn: 'onMybuttonTap',
            event: 'tap',
            delegate: '#loginButton'
        }
    ]
},

onMybuttonTap: function(button, e, eOpts) {
    //button.up().up().animateActiveItem(1, { type: 'flip' });

    var mainTabPanel = Ext.ComponentQuery.query("toppanel")[0];
    mainTabPanel.animateActiveItem(1, { type: 'flip' });

}