材质图标显示难看

时间:2020-12-30 06:11:30

标签: angular angular-material google-material-icons

我正在尝试为我的角度数据表使用角度材质图标。我为我的角度数据表遵循这个toturial。我看到相同的代码在他的屏幕上显示了一个漂亮的图标,而我的屏幕上却显示了一个丑陋的图标,

这是我的代码。

datatable css 文件代码。

.full-width-table {
  width: 100%;
}

datatable 组件 html 文件代码。

.....
.....
<ng-container matColumnDef="actions">
      <mat-header-cell *matHeaderCellDef></mat-header-cell>
      <mat-cell *matCellDef="let row">
        <button mat-icon-button><mat-icon>launch</mat-icon></button>
        <!-- <button mat-icon-button color="warn"><mat-icon>delete_outline</mat-icon></button> -->
      </mat-cell>
    </ng-container>
....
....

我的 appModule 文件

@NgModule({
  imports: [
    BrowserModule,
    BrowserAnimationsModule,
    AppRoutingModule,
    AppAsideModule,
    AppBreadcrumbModule.forRoot(),
    AppFooterModule,
    AppHeaderModule,
    AppSidebarModule,
    PerfectScrollbarModule,
    BsDropdownModule.forRoot(),
    TabsModule.forRoot(),
    ChartsModule,
    SelectDropDownModule,
    FormsModule,
    ReactiveFormsModule,
    CommonModule,
    CollapseModule,
    HttpClientModule,
    MatTableModule,
    MatPaginatorModule,
    MatSortModule,
    MatIconModule
],...

我已将此链接包含在我的 index.html 中

<link rel="shortcut icon" href="assets/favicon.ico">
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">

为什么我得到了一个丑陋的图标,但我的导师却得到了具有相同代码的漂亮图标。 什么事情需要做才能得到正确的。你可以通过附加图片看到我得到的。

enter image description here

2 个答案:

答案 0 :(得分:0)

style.css 或 style.scss

@import "../node_modules/@angular/material/prebuilt-themes/deeppurple-amber.css";

Index.html

<link href="https://fonts.googleapis.com/css?family=Material+Icons|Material+Icons+Outlined|Material+Icons+Two+Tone|Material+Icons+Round|Material+Icons+Sharp" rel="stylesheet">

导入上面那行就可以看到漂亮的图标

答案 1 :(得分:0)

<button mat-mini-fab color="warn" aria-label="">
    <mat-icon>filter_list</mat-icon>
</button>

参考网址 - https://material.angular.io/components/button/overview