我可以使用多个路由器在backbone.js
,这不会互相干扰其他路由,没有任何问题?或者有什么我应该关注的?多个路由器backbone.js
代码示例:
myapp.routers.main = Backbone.Router.extend({
routes : { "": "index" },
index : function() { console.log("routed by main router");}
});
myapp.routers.another = Backbone.Router.extend({
routes : { "notmain": "index" },
index : function() { console.log("routed by another router");}
});
mainrouter = new vaikava.routers.main;
notmainrouter = new vaikava.routers.another;
Backbone.history.start();
回答这个问题最简单的方法就是试试看看它是否有效。据我所知,你所描述的内容应该没有问题。 – nrabinowitz
我自己尝试过 - 没有错误,但由于这是我第一个真正的主干应用程序,我读过可能存在多个路由器的问题,我想在这里问 – Industrial