2013-06-01 39 views
2

来制作MVC登录和主视图我想问哪一种是使用MVC模式管理ExtJS 4.2中多个视图的最佳方法。如何使用ExtJS

我的意思是,如果我必须有一个登录表单,然后当有人登录,我必须改变到另一个视图,我怎么能这样做?

我必须将登录和其他视图放入ViewPort吗?有没有人有我能如何管理这个问题的例子?你建议什么结构?

回答

3

您的登录应该是一个独立的视图。以下是您如何构建您的MVC代码的示例:

Ext.application({ 
    name: 'xxx', 
    models: [ 
     // ... 
    ], 
    views: [ 
     // ...  
    ], 
    stores: [ 
     // ... 
    ], 
    controllers: [ 
     // ... 
    ], 

    // ... 

    launch: function() { 
     // at the beginning show only the login form 
     this.showLoginView(); 
    }, 
    // when the login is successfull, show your main view 
    login: function(username, password) { 
     this.showMainView(); 
    } 
});