重庆熊猫 Loading

ExtJS 布局-Auto布局(Auto Layout)

更新记录
2022年5月30日 开启本篇

ExtJS教程汇总:https://www.cnblogs.com/cqpanda/p/16328016.html

1.说明

image
auto布局是大部分容器默认的布局类型。
auto布局通常是从上到下进行堆叠,auto布局不会设置子组件的宽度,默认与容器一样的宽度。
类似于HTML中div标签,默认占满宽度,高度随内容。

2.设置布局方法

layout: 'auto'

或者

layout: {
  type: 'auto'
}

3.适合和不适合场景

适合场景:

1.组件从上到下进行堆叠布局。

不适合场景:

1.组件需要多列并列排序布局。
2.组件需要按固定位置排列布局。

4.实例

4.1 实例:从上到下堆叠子组件

image

{
    xtype: 'container',
    layout: 'auto',
    items: [
        {
            xtype: 'panel',
            collapsible: true,
            title: 'panel-1',
            html: 'panel-1',
            width: 300
        },
        {
            xtype: 'panel',
            collapsible: true,
            title: 'panel-2',
            html: 'panel-2'
        },
        {
            xtype: 'panel',
            collapsible: true,
            title: 'panel-3',
            html: 'panel-3',
            width: 500
        }
    ]
}
posted @ 2022-05-30 19:44  重庆熊猫  阅读(221)  评论(0编辑  收藏  举报