我有一个正在构建的MVC Sencha Touch应用程序,但在让 TabPanel 正常运行时遇到了一些问题。问题是这样的,当我有这样的 PosViewport.js 时,一切正常:
touch.views.PosViewport = new Ext.extend(Ext.TabPanel, {
initComponent: function () {
console.log("inside initComponent() of PosViewport.js");
touch.views.PosViewport.superclass.initComponent.call(this);
},
tabBar: {
dock: 'bottom',
layout: {
pack: 'center'
}
},
layout: 'fit',
scroll: 'vertical',
items: [
{
title: 'Reciepts',
iconCls: 'bookmarks',
html: 'one'
},
{
title: 'POS',
iconCls: 'Favorites',
html: 'two'
}
]
});
在这里,一切都很棒!标签栏显示在底部,非常适合,我可以毫无问题地在两者之间来回切换。
但是,我们不要将这些面板保存在我的 PosViewport.js 文件中,而是将它们移到两个单独的文件中:
View1.js:
touch.views.View1 = new Ext.extend(Ext.Panel, {
initComponent: function () {
touch.views.View1.superclass.initComponent.call(this);
},
layout: 'fit',
scroll: 'vertical',
fullscreen : true,
title: 'Reciepts',
iconCls: 'bookmarks',
html: 'panel one'
});
和 View2.js:
touch.views.View2 = new Ext.extend(Ext.Panel, {
initComponent: function () {
touch.views.View2.superclass.initComponent.call(this);
},
layout: 'fit',
scroll: 'vertical',
fullscreen : true,
title: '2',
iconCls: 'bookmarks',
html: 'panel two'
});
我将两个新视图都添加到我的 index.html 中。现在,我更新我的 PosViewport.js 以指向新视图:
touch.views.PosViewport = new Ext.extend(Ext.TabPanel, {
initComponent: function () {
console.log("inside initComponent() of PosViewport.js");
touch.views.PosViewport.superclass.initComponent.call(this);
},
tabBar: {
dock: 'bottom',
layout: {
pack: 'center'
}
},
layout: 'fit',
scroll: 'vertical',
items: [ touch.views.View1, touch.views.View2]
});
这一切都下地狱了。底部标签栏不可见,因为页面上只有一小部分顶部可见。面板根本不显示,我根本看不到它们的 HTML 内容。
这里发生了什么?我完全不知道它为什么会这样。非常感谢任何正确方向的指示,谢谢!