如何扩展Ext.tab.Panel

发布于 2025-01-07 22:43:25 字数 1824 浏览 2 评论 0原文

我目前正在为我的新项目使用 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

末蓝 2025-01-14 22:43:25

那是因为你使用了别名。将 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文