问题描述
我想通过不同的查询参数路由到我的路由模块中的不同组件:
像这样的网址:
url1: .../system?tab=actor
url2: .../system?tab=director
myroutingmodule:
const routes: Routes = [
{
matcher: isActorTab,component: ActorComponent,},{
matcher: isDirectorTab,component: DirectorComponent,
isActorTab和isDirectorTab在哪里
export function isActorTab(url: UrlSegment[]) {
return !window.location.href.includes('tab=actor') ? ({consumed: url}) : null;
}
export function isDirectorTab(url: UrlSegment[]) {
return !window.location.href.includes('tab=director') ? ({consumed: url}) : null;
}
我的问题是,window.location.href是访问查询参数的唯一方法吗?
以这种方式使用匹配器是否正确?我的意思是,这似乎让我惊叹号!在include的前面,以路由到该组件...正好相反,我认为这是必需的...
伙计,我已经很清楚了... 预先感谢
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)