小编Bia*_*meê的帖子

(IONIC 4) ion-tab-button 在点击/选择时不会改变颜色

我有一个ion-tab与型动物的方式来重定向:通过在路线tabs.module.ts,并通过[routerLink]在HTML中。

问题是:当ion-tab-buttons点击它们时,它们可以正确导航到其他页面,但颜色仅在使用路由和“loadchildren”路由时才会改变。

使用 CSS:

ion-tab-button {
 --color-selected: var(--ion-color-text-secondary);
}
Run Code Online (Sandbox Code Playgroud)

我尝试loadChildren在所有选项卡中使用路由,但有些选项卡要重定向到组件并且没有成功。我还尝试在 CSS 中使用伪类,例如

ion-tab-button:active {
    color: blue;
}
Run Code Online (Sandbox Code Playgroud)

实际文件:

标签页.html

<ion-tabs>
  <ion-tab-bar slot="bottom">
    <ion-tab-button tab="home">
      <i class="fal fa-home-alt fa-2x"></i>
    </ion-tab-button>

    <ion-tab-button [routerLink]="['/tabs/home/feed/feed-user/' + id]">
      <i class="fal fa-user-circle fa-2x"></i>
    </ion-tab-button>

    <ion-tab-button [routerLink]="['/tabs/home/trade-room']">
      <i class="fal fa-comments-alt-dollar fa-2x"></i>
    </ion-tab-button>
  </ion-tab-bar>
</ion-tabs>
Run Code Online (Sandbox Code Playgroud)

tabs.module.ts

const routes: Routes = [
  {
    path: '',
    component: TabsPage,
    children: [
     {
        path: '',
        redirectTo: '/tabs/home',
        pathMatch: 'full'
     },
      {
        path: …
Run Code Online (Sandbox Code Playgroud)

angular ionic4

3
推荐指数
1
解决办法
2924
查看次数

标签 统计

angular ×1

ionic4 ×1