0

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 数据

4

1 回答 1

2

那样有用吗?

 { path: 'log', component: LogComponent, children: [
    { path: '', component: Log1Component },
    { path: 'log1', component: Log1Component },
    { path: 'log2', component: Log2Component ,pathMatch: 'full' }
   ]
 }
于 2018-02-25T07:26:58.200 回答