繁体   English   中英

如何为 nb-route-tabset/ngx-admin 设置 activeLinkOptions

[英]how to set activeLinkOptions for nb-route-tabset/ngx-admin

我希望为多个链接突出显示选项卡。 我不确定我是否误解了功能。 以下是我的代码。

<div class="row">
  <div class="col-12">
    <nb-card size="small">
      <nb-route-tabset [tabs]="tabs" fullWidth activeLinkOptions="{exact:
    false}"></nb-route-tabset>
    </nb-card>
 </div>
</div>

我的组件:

  tabs: any[] = [
  {
    title: 'Contacts',
    route: '/addressbook/contact',
    icon: 'person-outline',
    responsive: true, 
  },
  {
    title: 'Companies',
    route: '/addressbook/company',
    icon: 'people-outline',
    responsive: true, 

  },
  {
    title: 'Company Types',
    route: '/addressbook/companytype/index',
    icon: 'grid-outline',
    responsive: true, 
  },
];

渲染的 html:

<li _ngcontent-eap-c56="" class="route-tab responsive ng-star-inserted" routerlinkactive="active" tabindex="0" ng-reflect-router-link="/addressbook/companytype/index" ng-reflect-router-link-active-options="{exact:
    false}" ng-reflect-router-link-active="active">

我希望每当我访问“/addressbook/companytype/create”时,“公司类型”选项卡都会突出显示。 这是“exact:false”的预期行为吗?

任何帮助将不胜感激!

Jason 上面在 stackblitz 上尝试的评论帮助我理解了 activeLinkOptions 的用法。 我的两个网址如下。

"/addressbook/companytype/Index" - 父级 "/addressbook/companytype/create" - 子级

如您所见,孩子不是从父母那里继承的。 所以它没有用。 现在将 URL 更改为如下所示,效果很好。

"/addressbook/companytype" - 父级 "/addressbook/companytype/create" - 子级

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM