我正在从事ChaplinJS (主干框架)的工作。以下是我的route.js代码块。
return function(match) {
match(':customer/getCardsNavSummary', {controller:'customer', action:'showPlan'});
match(':customer/getCardsNavSummary/:plan/:row', {controller:'customer', action:'showPlan'});
};相反,我想做以下事情
return function(match) {
match(':customer/getCardsNavSummary(/:plan/:row)', {controller:'customer', action:'showPlan'});
};这对Backbone很有效。我也检查了rails的路由代码,它在那里工作。但是当涉及到巫师时,它就不会了!
在chaplinJS文档中,我没有找到任何与路由器可选参数相关的内容。
发布于 2013-07-19 18:46:56
Chaplin.Router不扩展Backbone.Router。据我所知,使用Chaplin.Router不可能实现您想要实现的目标。
由于您期望的端点对于两个路由(customer:showPlan)是相同的,一种可能的解决方法是使用具有匹配getCardsNavSummary和getCardsNavSummary-plan-row模式的regexp的constraints option,然后在控制器中,根据需要检查和解析此端点。
https://stackoverflow.com/questions/17715894
复制相似问题