1
Ext.create('Ext.panel.Panel', {
renderTo: Ext.getBody(),
width: 400,
height: 300,
title: 'Container Panel',
items: [
{
xtype: 'panel',
title: 'Child Panel 1',
height: 100,
width: '75%'
},
{
xtype: 'panel',
title: 'Child Panel 2',
height: 100,
width: '75%'
}
]
});
上面的代碼沒有被執行......你能找到錯誤或錯誤。我對extjs很陌生。我在通過documentaion(檢查「容器」部分)時找到了上述代碼。它在jsfiddle中執行得很好,但不在我的項目中(其他示例在我的項目中正常工作)。extjs示例代碼不起作用
答:
Ext.onReady(function(){
Ext.create('Ext.panel.Panel', {
renderTo: Ext.getBody(),
width: 400,
height: 300,
layout: 'hbox',
title: 'Container Panel',
items: [
{
xtype: 'panel',
title: 'Child Panel 1',
height: 100,
flex:1
},
{
xtype: 'panel',
title: 'Child Panel 2',
height: 100,
flex:1
}
]
});
});
我做了你所說的..我不確定我是否按照提到的那樣操作,但它仍然在chrome中顯示空白頁沒有控制檯錯誤。請檢查我編輯的帖子.. –
那麼,#1你沒有放置hbox佈局。 #2您的onReady呼叫不正確。看看任何例子,你會明白爲什麼它是錯的。 –
我無法在文檔中找到任何已有的函數。我保留'layout:'hbox''。請給我一個示例代碼..瞭解onready函數。 –