2012-02-23 100 views
0

我目前正在为我的新项目使用ExtJS 4。我正在使用MVC架构并为其他组件使用小部件。如何扩展Ext.tab.Panel

问题是我无法为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    
          }   
        ]  
       }); 
     } 
}); 

视图/ 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 

回答

0

那是因为你所使用的别名。将alias: 'widget.tab'更改为其他内容(例如,widget.tab2),它将起作用。

+0

大声笑,我不知道是否使用“标签”。谢啦 – 2012-02-23 08:48:19