首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Chaplin路由器可选参数

Chaplin路由器可选参数
EN

Stack Overflow用户
提问于 2013-07-18 14:16:49
回答 1查看 437关注 0票数 0

我正在从事ChaplinJS (主干框架)的工作。以下是我的route.js代码块。

代码语言:javascript
复制
return function(match) {        
    match(':customer/getCardsNavSummary', {controller:'customer', action:'showPlan'});
    match(':customer/getCardsNavSummary/:plan/:row', {controller:'customer', action:'showPlan'});
};

相反,我想做以下事情

代码语言:javascript
复制
return function(match) {
        match(':customer/getCardsNavSummary(/:plan/:row)', {controller:'customer', action:'showPlan'});
    };

这对Backbone很有效。我也检查了rails的路由代码,它在那里工作。但是当涉及到巫师时,它就不会了!

在chaplinJS文档中,我没有找到任何与路由器可选参数相关的内容。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2013-07-19 18:46:56

Chaplin.Router不扩展Backbone.Router。据我所知,使用Chaplin.Router不可能实现您想要实现的目标。

由于您期望的端点对于两个路由(customer:showPlan)是相同的,一种可能的解决方法是使用具有匹配getCardsNavSummary和getCardsNavSummary-plan-row模式的regexp的constraints option,然后在控制器中,根据需要检查和解析此端点。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/17715894

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档