次のプロジェクトの基礎となるこの StackOverflow questionを見つけました。
「オプション」セグメントボタンごとに、異なる HTML ページを表示したいと考えています。これを実現するために SegView クラスを変更しました。ただし、ここでは、左右の余白を 10% の間隔に設定したいと考えています。つまり、私のコンテンツは中央の 80% に集中します。
コンテナに余白を設定するだけで、コンテンツが枠にはまらないようにすることはできますか?
他の StackOverFlow questionから変更された SegView クラスは次のとおりです。
Ext.define('SenchaFiddle.view.SegView', {
extend: 'Ext.Container',
xtype: 'seg-view',
config: {
layout: 'fit',
items: [
{
layout: 'vbox',
items: [
{
xtype: 'segmentedbutton',
allowDepress: true,
layout:{pack:'center'},
items: [
{
text: 'Option 1',
pressed: true,
handler: function () {
console.log("Picked #1");
Ext.getCmp('card-container').setActiveItem(0);
}
},
{
text: 'Option 2',
handler: function () {
Ext.getCmp('card-container').setActiveItem(1);
}
},
{
text: 'Option 3',
handler: function () {
Ext.getCmp('card-container').setActiveItem(2);
}
}
]
},
{
xtype: 'container',
flex: 10,
id: 'card-container',
layout: {
type: 'card'
},
items: [
{
xtype: 'container',
style: 'background-color: #fff',
items: [
{
html: ['<h2 style="text-align: center;">Lorum ipsum</h2>',
"<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</p>",
'<p>Hello world</p>'].join("")
},
{
html: ['<h2 style="text-align: center;">Lorum ipsum</h2>',
"<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</p>",
'<p>Hello world</p>'].join("")
}
]
},
{
html: ['<p>Lorum ipsum</p>',
'<p>Page #2</p>'].join(""),
style: 'background-color: #666'
},
{
html: ['<p>Lorum ipsum</p>',
'<p>Page #3</p>'].join(""),
style: 'background-color: #333'
}
]
}
]
}
]
}
});