页面加载时默认显示第一个选项卡
display first tab as default when page loads
log.component.html:
<clr-tabs>
<clr-tab>
<button style="margin-left: 3% !important;" clrTabLink [routerLink]="'log1'">Log1</button>
<ng-template [(clrIfActive)]="log1">
<clr-tab-content>
<div class="main-container">
<div class="content-container">
<div class="content-area">
<router-outlet></router-outlet>
</div>
</div>
</div>
</clr-tab-content>
</ng-template>
</clr-tab>
<clr-tab>
<button style="margin-left: 3% !important;" clrTabLink [routerLink]="'log2'">Log2</button>
<ng-template [(clrIfActive)]="log2">
<clr-tab-content>
<div class="main-container">
<div class="content-container">
<div class="content-area">
<router-outlet></router-outlet>
</div>
</div>
</div>
</clr-tab-content>
</ng-template>
</clr-tab>
route.module.ts:
{ path: 'log', component: LogComponent, children: [
{ path: 'log1', component: Log1Component },
{ path: 'log2', component: Log2Component ,pathMatch: 'full' }
]
}
我想在用户点击 /log 时默认加载 log1 选项卡内容,如何实现此功能,任何指示对像我这样的初学者都有用。
当前点击 log1 时,它会显示两个选项卡,当我点击第一个选项卡时,它会显示 tab1 的内容,我需要默认显示此 tab1 数据
这样行吗?
{ path: 'log', component: LogComponent, children: [
{ path: '', component: Log1Component },
{ path: 'log1', component: Log1Component },
{ path: 'log2', component: Log2Component ,pathMatch: 'full' }
]
}
log.component.html:
<clr-tabs>
<clr-tab>
<button style="margin-left: 3% !important;" clrTabLink [routerLink]="'log1'">Log1</button>
<ng-template [(clrIfActive)]="log1">
<clr-tab-content>
<div class="main-container">
<div class="content-container">
<div class="content-area">
<router-outlet></router-outlet>
</div>
</div>
</div>
</clr-tab-content>
</ng-template>
</clr-tab>
<clr-tab>
<button style="margin-left: 3% !important;" clrTabLink [routerLink]="'log2'">Log2</button>
<ng-template [(clrIfActive)]="log2">
<clr-tab-content>
<div class="main-container">
<div class="content-container">
<div class="content-area">
<router-outlet></router-outlet>
</div>
</div>
</div>
</clr-tab-content>
</ng-template>
</clr-tab>
route.module.ts:
{ path: 'log', component: LogComponent, children: [
{ path: 'log1', component: Log1Component },
{ path: 'log2', component: Log2Component ,pathMatch: 'full' }
]
}
我想在用户点击 /log 时默认加载 log1 选项卡内容,如何实现此功能,任何指示对像我这样的初学者都有用。
当前点击 log1 时,它会显示两个选项卡,当我点击第一个选项卡时,它会显示 tab1 的内容,我需要默认显示此 tab1 数据
这样行吗?
{ path: 'log', component: LogComponent, children: [
{ path: '', component: Log1Component },
{ path: 'log1', component: Log1Component },
{ path: 'log2', component: Log2Component ,pathMatch: 'full' }
]
}