如何扩展Ext.tab.Panel
我目前正在为我的新项目使用 ExtJS 4。我正在使用 MVC 架构并为其他组件使用小部件。
问题是我无法为 Ext.tab.Panel 创建实例。这是我的代码
app.js
Ext.Loader.setConfig({ enabled: true });
Ext.application({
name: 'FBSPAM',
autoCreateViewport: false,
appFolder: 'app',
controllers: ['Users'],
launch: function(){
Ext.create('Ext.container.Viewport', {
layout: 'border',
title: 'App',
items: [
{
region: 'west',
title: 'Menu',
width: 250,
xtype: 'accordionmenu'
},
{
region: 'center',
xtype: 'tab'
//items: tabpanel
}
]
});
}
});
view/Tab.js
Ext.define('FBSPAM.view.Tab',{
extend: 'Ext.tab.Panel',
alias: 'widget.tab',
height: '100%',
layout: 'fit',
border: false,
initComponent: function(){
this.items = [
{
title: "Hello",
html: "Hello World"
}
];
this.callParent(arguments);
}
});
错误消息:
Uncaught RangeError: Maximum call stack size exceeded
I'm currently playing with ExtJS 4 for my new project. I'm using MVC architecture and use widget for others component.
The problem is I can't make instance for Ext.tab.Panel. Here's my code
app.js
Ext.Loader.setConfig({ enabled: true });
Ext.application({
name: 'FBSPAM',
autoCreateViewport: false,
appFolder: 'app',
controllers: ['Users'],
launch: function(){
Ext.create('Ext.container.Viewport', {
layout: 'border',
title: 'App',
items: [
{
region: 'west',
title: 'Menu',
width: 250,
xtype: 'accordionmenu'
},
{
region: 'center',
xtype: 'tab'
//items: tabpanel
}
]
});
}
});
view/Tab.js
Ext.define('FBSPAM.view.Tab',{
extend: 'Ext.tab.Panel',
alias: 'widget.tab',
height: '100%',
layout: 'fit',
border: false,
initComponent: function(){
this.items = [
{
title: "Hello",
html: "Hello World"
}
];
this.callParent(arguments);
}
});
Error Message:
Uncaught RangeError: Maximum call stack size exceeded
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
那是因为你使用了别名。将
alias: 'widget.tab'
更改为其他内容(例如widget.tab2
),它将起作用。That's because you use taken alias. Change
alias: 'widget.tab'
to something else (eg.widget.tab2
) and it will work.