Pathjs路由问题

时间:2013-02-15 01:20:54

标签: javascript jquery html5 html5-history path.js

我有这条路线:

Path.map("/(:page_1)(/:page_2)/").to(funct);

并且不匹配

/projects/index2/

它匹配/anything但不匹配/anything/anything

有什么想法吗?

1 个答案:

答案 0 :(得分:2)

尝试仅在括号中包装第二个可选值。所以,而不是做:

Path.map("#/(:page_1)(/:page_2)/").to(funct);

尝试:

Path.map("#/:page_1(/:page_2)").to(funct);

查看这个jsfiddle:http://jsfiddle.net/Jkeq9/1/