Ind*_*ial 14 router 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();
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
7864 次 |
| 最近记录: |