快速提问:是否有可能发送类似Domain.com/@Username的内容?@是用户名本身的not部分.
我已经试了{ path: "@:username", component: UserComponent }
次,但这个似乎不起作用.
{ path: "@/:username", component: UserComponent }
个也行,但看起来很?
快速提问:是否有可能发送类似Domain.com/@Username的内容?@是用户名本身的not部分.
我已经试了{ path: "@:username", component: UserComponent }
次,但这个似乎不起作用.
{ path: "@/:username", component: UserComponent }
个也行,但看起来很?
我刚刚在棱角文件里找到了routing with url matcher美元的答案.
const routes: Routes = [
{
matcher: (url) => {
if (url.length === 1 && url[0].path.match(/^@.+$/gm)) {
return {
consumed: url
posParams: {
username: new UrlSegment(url[0].path.slice(1), {}),
},
};
}
return null;
},
component: UserComponent,
},
];