【问题标题】:Ext.Container height and width on 100 percentExt.Container 高度和宽度为 100%
【发布时间】:2021-01-16 12:53:35
【问题描述】:

我使用的是 extjs 3.4

我想要一个容器,它占据屏幕 100% 的高度和宽度。在那个容器内,我只有两个面板,每个面板都有 50% 的高度和 100% 的宽度。

我真的不知道我在这里做错了什么?我可以以像素为单位指定每个组件的宽度和高度,但我想设置百分比。如何做到这一点?

Ext.onReady(function() {

        var ct = new Ext.Container({
            renderTo: Ext.getBody(),
            style: 'background-color: pink;',
            width: '100%',
            height: '100%',
            items:[
                {
                    layout: 'vbox',
                    align: 'stretch',
                    items:[{
                        xtype: 'panel',
                        title: 'first panel',
                        flex: .5
                    },{
                        xtype: 'panel',
                        title: 'second panel',
                        flex: .5
                    }]
                }]
        });
    });

【问题讨论】:

    标签: extjs


    【解决方案1】:

    您可以使用“ViewPost”,例如:

    Ext.onReady(function () {
        var viewPort = new Ext.Viewport({
            layout: {
                type: 'vbox',
                align: 'stretch'
            },
            defaults: {
                xtype: 'panel',
                flex: 1
            },
            items: [{
                title: 'first panel'
            }, {
                title: 'second panel'
            }]
        });
    
    });
    

    【讨论】:

      猜你喜欢
      • 2018-02-26
      • 1970-01-01
      • 2019-12-06
      • 2016-08-09
      • 2015-02-04
      • 2011-01-14
      • 2013-11-09
      • 2013-12-06
      • 1970-01-01
      相关资源
      最近更新 更多