[英]How can I define state parameters in Aurelia router
I am new to Aurelia and in the router configuration, I want to define state parameter and to navigate to that state when I click to the generated link by the router. 我是Aurelia的新手,在路由器配置中,我想定义状态参数并单击路由器生成的链接时导航到该状态。 I could not find any reference and a question about this
我找不到任何参考和有关此问题
Not sure if I understand your question... 不知道我是否理解你的问题...
Let's suppose you want to create an "edit" route. 假设您要创建一个“编辑”路线。 This route would be parametrized with an "id".
该路由将使用“ id”进行参数设置。 Then, you should use a symbol, like
:id
, to represent the parameter. 然后,您应该使用诸如
:id
类的符号来表示参数。 Like this: 像这样:
export class App {
configureRouter(config, router) {
config.title = 'Aurelia';
config.map([
{ route: ['','user'], name: 'user', moduleId: 'users/user', params:"id" nav: true, title:'User' }
//route with param
{ route: 'user/:id, name: 'userEdit', moduleId: 'users/edit', nav: false, title:'Edit User' }
]);
this.router = router;
}
}
Hope it helps! 希望能帮助到你!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.