Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/backbone.js/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Backbone.js 在路由器上使用方法添加标准路由_Backbone.js_Marionette - Fatal编程技术网

Backbone.js 在路由器上使用方法添加标准路由

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

()


它在现实中会是什么样子

您可以在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.
  }
});