Backbone.js 在路由器上使用方法添加标准路由
在主干网.木偶文件中,有一句话让我感到困惑: 您还可以使用路由器上的方法将标准路由添加到AppRouter ()Backbone.js 在路由器上使用方法添加标准路由,backbone.js,marionette,Backbone.js,Marionette,在主干网.木偶文件中,有一句话让我感到困惑: 您还可以使用路由器上的方法将标准路由添加到AppRouter () 它在现实中会是什么样子 您可以在AppRouter上添加路由,并定义在路由器或控制器中处理路由的方法 MyRouter = Backbone.Marionette.AppRouter.extend({ // "someMethod" must exist at controller.someMethod appRoutes: { "some/route": "some
它在现实中会是什么样子 您可以在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.
}
});