sencha > layout (布局)

横向布局

Ext.create('Ext.Container', {
    fullscreen: true,
    layout: 'hbox',
    items: [
        {
            xtype: 'panel',
            html: 'message list',
            flex: 1
        },
        {
            xtype: 'panel',
            html: 'message preview',
            flex: 2
        }
    ]
});

 

纵向布局

Ext.create('Ext.Container', {
    fullscreen: true,
    layout: 'vbox',
    items: [
        {
            xtype: 'panel',
            html: 'message list',
            flex: 1
        },
        {
            xtype: 'panel',
            html: 'message preview',
            flex: 2
        }
    ]
});

 

** 卡片布局

 

Ext.application({
    name: 'MyApp',
	launch: function(){   
		//this is the Panel we'll be adding below
			var panel = Ext.create('Ext.Panel', {
				layout: 'card',
				items: [
					{
						html: "First Item"
					},
					{
						html: "Second Item"
					},
					{
						html: "Third Item"
					},
					{
						html: "Fourth Item"
					}
				]
			});

			panel.setActiveItem(0);	
			Ext.Viewport.add(panel);

	}
});

 

** 自适应布局, 子组件会 适应父组件的长宽

var panel = Ext.create('Ext.Panel', {
    width: 200,
    height: 200,
    layout: 'fit',

    items: {
        xtype: 'panel',
        html: 'Also 200px by 200px'
    }
});

Ext.Viewport.add(panel);

 

** docked  (漂浮)

Ext.application({
    name: 'MyApp',
	launch: function(){   
		//this is the Panel we'll be adding below
		Ext.create('Ext.Container', {
			fullscreen: true,
			layout: 'hbox',
			items: [
				{
					docked: 'top',
					xtype: 'panel',
					height: 20,
					html: 'This is docked to the top'
				},
				{
					xtype: 'panel',
					html: 'message list',
					flex: 1
				},
				{
					xtype: 'panel',
					html: 'message preview',
					flex: 2
				}
			]
		});



	}
});

 

 ** 轮播 布局

Ext.application({
    name: 'Sencha',
    launch: function() {
		Ext.create('Ext.Carousel', {
			fullscreen: true,

			defaults: {
				styleHtmlContent: true
			},

			items: [
				{
					html : 'Item 1',
					style: 'background-color: #5E99CC'
				},
				{
					html : 'Item 2',
					style: 'background-color: #759E60'
				},
				{
					html : 'Item 3'
				}
			]
		});
    }
});

 

 

 

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值