一、菜单
{
//银行卡基础信息维护
rsId: 'menu.param.cardbin',
iconCls: 'icon-double-angle-right',
name: menusLang._('menu.param.cardbin'),
url: '#',
deps: ['app/param/card-bin/card-bin-app'],// app/param/card-bin/list/list-view
trigger: 'card-bins:list'
}
二、第二步
define(['app'],
function(App) {
App.module('CardBinApp', function(CardBinApp) {
var CardBinAppRouter = Marionette.AppRouter.extend({
appRoutes: {
"card-bins(/filter/kw::kw)": "listCardBins"
}
});
/////////////////////////////////////////////////////////////////
// define methods for interaction (with parent app) and router //
/////////////////////////////////////////////////////////////////
var API = {
listCardBins: function(kw) {
console.log('>>>>param-sys.listCardBins ' + (kw || ''));
require(['app/param/card-bin/list/list-controller'], function (ctrl) {
ctrl.listCardBins(kw);
});
}
};
//if it is not used to map the url first time typed in browser
//u can new router anywhere before u want, otherwise, u should
//add router before start Backbone history
new CardBinAppRouter({ controller: API });
/////////////////////////////////////////////////
//register events or command to parent app //////
/////////////////////////////////////////////////
App.on('card-bins:list', function(kw) {
API.listCardBins(kw);
});
//this callback will be invoked before parent app:initilize:after
App.addInitializer(function() {
console.log('>>>>new CardBinAppRouter');
});
});
return App.CardBinApp;
});
三、第三步 controller
define(['app'], function(App) {
App.module('aaa.bbb', function(List, App, Backbone, Marionette, $, _) {
List.Controller = {
listCardBins: function(kw) {
require([''], function(View) {
var xxx = new View.xxxx({});
App.show(xxx);
});
}
};
});
return aaa.bbb.Controller;
});
四、list-view
define(['app'], function(App, paramLang) {
App.module('aaa.bbb.View', function(View, App, Backbone, Marionette, $, _) {
View.xxxx = .....
});
return aaa.bbb.View;
});