1
여러 옵션이있는 라우터가 있습니다. 하나의 인스턴스에 대해 잘 작동하는 경로 중 하나를로드해야하지만, 기본 경로는 항상 일부 추가 템플릿에서로드됩니다. .
이 경우이 CMS에서이 경로가 기본 경로의 요소를로드하지 않는다고 말할 수있는 방법이 있는지 궁금합니다. 내 라우터에서
코드 :Backbone.js 라우팅 조건부 기본 경로
define([
'jquery',
'underscore',
'backbone',
'views/common/header',
'views/common/menu',
'views/rightPanel',
'views/landing',
'views/personalBanking',
'views/currentAccounts',
'views/signIn',
'views/cms/cmsView',
], function($, _, Backbone, headerView, menuView, rightPanelView, landingView, personalBankingView, accountsView, signInView, CMS){
var AppRouter = Backbone.Router.extend({
currentView: null,
initialize: function() {
this.showView(headerView);
this.showView(menuView);
//TODO set for TV-width
if($(window).width() > 180) {
this.showView(rightPanelView);
}
},
routes: {
'': 'defaultAction',
'personal': 'showPersonalBankingView',
'accounts': 'showCurrentAccountsView',
'signIn': 'showSignInView',
'CMS': 'CMSView',
},
defaultAction: function(actions){
this.showView(landingView);
},
showPersonalBankingView: function(actions){
this.showView(personalBankingView);
},
showCurrentAccountsView: function(actions){
this.showView(accountsView);
},
showSignInView: function(actions){
this.showView(signInView);
},
CMSView: function(actions){
this.showView(CMS);
console.log("cms view going on");
},
showView: function(view) {
view.render();
if(view.postRender) {
view.postRender();
}
}
});
var initialize = function(){
new AppRouter();
Backbone.history.start();
};
return {
initialize: initialize
};
});
내가 충분히 상세하게 설명하지 않은 경우 도움을 기대하고, 자세한 내용은 저에게 문의하시기 바랍니다 나는 백본에 아주 새로운 오전.