2013-04-11 61 views

回答

0

您可以在AppRouter上添加路由并定义在路由器或控制器中处理它的方法。

MyRouter = Backbone.Marionette.AppRouter.extend({ 
    // "someMethod" must exist at controller.someMethod 
    appRoutes: { 
    "some/route": "someMethod" 
    "yet/anotherRoute": "routerMethod" // app router route 
    }, 

    /* standard routes can be mixed with appRoutes/Controllers above */ 
    routes : { 
    "some/otherRoute" : "someOtherMethod" 
    }, 
    // method on the router 
    routerMethod: function() { 
    // ... 
    }, 
    someOtherMethod : function(){ 
    // do something here. 
    } 
});