適合:在此布局中,容器用單個(gè)面板填充,當(dāng)沒有與布局相關(guān)的特定要求時(shí),則使用此布局。
這里是使用Fit布局的簡(jiǎn)單語(yǔ)法。
layout: 'fit'
以下是一個(gè)簡(jiǎn)單的示例,顯示了Fit布局的用法
<!DOCTYPE html>
<html>
<head>
<link href="./ext-6.0.0/build/classic/theme-classic/resources/theme-classic-all.css" rel="stylesheet">
<script src="./ext-6.0.0/build/ext-all.js"></script>
<script type="text/javascript">
Ext.onReady(function() {
Ext.create('Ext.container.Container', {
renderTo : Ext.getBody(),
layout : {
type :'fit'
},
width : 600,
defaults: {
bodyPadding: 15
},
items : [{
title: 'Panel1',
html : 'This is panel 1'
},{
title: 'Panel2',
html : 'This is panel 2'
},{
title: 'Panel3',
html : 'This is panel 3'
},{
title: 'Panel4',
html : 'This is panel 4'
}]
});
});
</script>
</head>
<body>
</body>
</html>
運(yùn)行結(jié)果如下:
更多建議: