[英]Advanced routes in backbone.js with functional grouping
这是我的路线结构的示例:
routes:{ "*actions" : "defaultHandler", //some default handler //handlers for all pages "Page1" : "Page1", . . . . . . . . . . "PageN" : "PageN", //and now I have a module, with it's own pages, and routes for it has similar look: "Module/Page01" : "Page01", . . . . . . . . . . "Module/PageNN" : "PageNN", /* and now I have to do some task for all navigations to the Module and I am trying to make this: */ "Module/*path" : "moduleHandler" /* and it's not working, because in this case on navigate, for example to the page "Module/Page01" only moduleHandler responding, not Page01 handler */ }
像那样。 而且我需要两个处理程序做出响应。 在文档中找不到任何技巧
您需要这样的东西: https : //github.com/FLOChip/backbone_router_filter但是,当然,这只是一个例子,您应该实现依赖于路由的过滤。 随时问您是否遇到困难。
更新 :我刚刚找到了这个: https : //github.com/angelo0000/backbone_filters 。 如果我了解这正是您想要的。
var R = Backbone.Router.extend({
routes: {
"page1": "page1",
"pageN": "pageN",
"module/page01": "page01",
"module/pageNN": "pageNN",
"*actions" : "defaultHandler"
},
before: {
'^module/': 'moduleFilter'
}
//...
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.