【问题标题】:Changing size for eye icon in angular material更改角度材料中眼睛图标的大小
【发布时间】:2021-03-04 19:09:40
【问题描述】:

我正在处理 angular material 中奇怪的 CSS 样式:

正如您在此处看到的,眼睛图标波纹正在从输入中消失,我正在尝试修复它,所以知道如何解决吗?

PS:我尝试了以下方法:

mat-form-field
  > .mat-form-field-wrapper
  > .mat-form-field-flex
  > .mat-form-field-outline {
  display: flex;
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
}

我有以下代码:

 <mat-form-field appearance="outline" floatLabel="always">
    <input
      matInput
      [type]="hide ? 'text' : type"
    />

但是没有任何效果,所以基本上我想在单击眼睛图标时减小阴影的大小,但是没有运气,有什么帮助吗?

【问题讨论】:

    标签: angular angular-material material-design


    【解决方案1】:

    我使用 scale() 函数来更改 html 中图标的大小,如下所示,这是一个有效的 stackblitz

    <mat-form-field class="example-form-field">
      <mat-label>Clearable input</mat-label>
      <input matInput type="text" [(ngModel)]="value">
      <button mat-button *ngIf="value" matSuffix mat-icon-button aria-label="Clear" (click)="value=''">
        <mat-icon class="transformation">close</mat-icon>
      </button>
    </mat-form-field>
    
    

    和css:

    .transformation {
      transform: scale(50%); // 50% for half its size
    }
    

    【讨论】:

    • 任何 stackblitz 链接都对实时检查更有帮助:-)
    • 我用 stackblitz 链接更新了我的答案。
    猜你喜欢
    • 2019-01-09
    • 2022-11-28
    • 2020-09-20
    • 1970-01-01
    • 2021-02-19
    • 2019-12-31
    • 2019-07-01
    • 2017-12-23
    • 2011-05-29
    相关资源
    最近更新 更多