简体   繁体   English

使用 mat-tab 将水平制表符转换为垂直制表符

[英]Convert horizontal tabs to vertical tabs using mat-tab

I am using mat-tab-group to display tabs horizontally.我正在使用 mat-tab-group 水平显示标签。 It looks ok on computer screen.在电脑屏幕上看起来没问题。 But on mobile screen, it does not look very neat.但是在手机屏幕上,它看起来不是很整洁。 Is there a way to convert it into vertical tab list if its mobile size screen?如果它的移动尺寸屏幕有没有办法将其转换为垂直选项卡列表?

   <mat-tab-group>
    <mat-tab>
      <ng-template mat-tab-label>
        <mat-icon ngClass="material-icons-outlined">home</mat-icon>
        <span>Account Summary</span>
    </ng-template>
      <ng-template matTabContent>
        <app-summary
        [loanNumber]="loanNumber"
      ></app-summary>
      </ng-template>
    </mat-tab>
    <mat-tab>
      .
      .      
      .
    </mat-tab>
</mat-tab-group>

You can achieve the basic functionality with css and "shadow-piercing"您可以使用 css 和“shadow-piercing”实现基本功能

https://stackblitz.com/edit/angular-tab-vert https://stackblitz.com/edit/angular-tab-vert

:host ::ng-deep {
  .mat-tab-labels {
    flex-direction: column;
  }
  .mat-tab-group {
    flex-direction: row;
  }
  .mat-ink-bar {
    height: 100%;
    left: 100% !important;
  }
  .mat-tab-header {
    border-bottom: none;
  }
  .mat-tab-body-wrapper {
    flex: 1 1 auto;
  }
} 

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

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