Meteor:Iron.Router Catch All(将匹配 URI 的其余部分)
Meteor: Iron.Router Catch All (Will match the rest of the URI)
是否可以使用匹配 URI 其余部分的参数来定义 Iron.Router 路由?
例如
Router.route('results', {
path: '/test/:domain'
});
这将匹配
等条目
- /test/你好
- /测试/hello.com
我真正需要的是匹配
等条目
- /test/你好.com/about
- /test/你好.com/about?param=3
想法?
想出办法了!
在这种情况下,路径现在是
Router.route('results', {
path: '/test/(.*)'
});
要访问尾随信息,请访问索引 0 处的参数
this.params[0]
是否可以使用匹配 URI 其余部分的参数来定义 Iron.Router 路由?
例如
Router.route('results', {
path: '/test/:domain'
});
这将匹配
等条目- /test/你好
- /测试/hello.com
我真正需要的是匹配
等条目- /test/你好.com/about
- /test/你好.com/about?param=3
想法?
想出办法了!
在这种情况下,路径现在是
Router.route('results', {
path: '/test/(.*)'
});
要访问尾随信息,请访问索引 0 处的参数
this.params[0]