小编Edr*_*ric的帖子

在 Material-UI 中合并主题配置设置

我想在 Material-UI 中设置自定义主题规则。我想制作明暗主题并使用一些常见设置对其进行扩展。

我认为将明暗主题的通用设置放在一个单独的变量中,然后将它们合并在一起是个好主意。

但是我遇到了用默认值覆盖自定义设置的问题。默认情况下,commonSettings具有所有类型的设置,即使我没有定义它们。通过合并,默认设置只需覆盖自定义设置。所以,也许有人已经遇到过这种情况,并且知道如何将两个设置数组合并为一个。

简单的例子:

const commonSettings= createMuiTheme({
    breakpoints: {...},
    direction: 'ltr',
    typography: {...},
});

const lightThemeSettings = createMuiTheme({
    palette: {...},
});

const darkThemeSettings = createMuiTheme({
    palette: {...},
});

// Merge together
const lightTheme = { ...commonSettings, ...lightThemeSettings };
const darkTheme = { ...commonSettings, ...darkThemeSettings };

export default { lightTheme, darkTheme };
Run Code Online (Sandbox Code Playgroud)

javascript arrays material-ui

0
推荐指数
1
解决办法
1812
查看次数

如何控制角垫图标的方向

角度版本:v9

我有一个按钮,它的垫子图标是一个指向左侧的箭头。我想知道 mat-icon 元素标签是否有任何属性可以让我控制箭头的方向,使其指向上方。

为了学习的目的,我更喜欢通过 angular.js 中的属性来学习如何做到这一点,而不是寻找另一个可以实现我想要的图标。

我在网上搜索,但找不到解决方案。因此这个问题。帮助表示赞赏。谢谢

icons angular-material angular

0
推荐指数
1
解决办法
4341
查看次数

安装材料设计后,由于 ngcc ,我无法编译角度代码。我附上了我的错误跟踪

Compiling @ng-bootstrap/ng-bootstrap : module as esm5
Error: Error on worker #1: Error: Failed to compile entry-point @ng-bootstrap/ng-bootstrap (module as esm5) due to compilation errors:
node_modules/@ng-bootstrap/ng-bootstrap/rating/rating.js:148:43 - error NG1006: Cannot combine @Input decorators with query decorators

148         "starTemplate": [{ type: Input }, { type: ContentChild, args: [TemplateRef,] },],
                                              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
node_modules/@ng-bootstrap/ng-bootstrap/rating/rating.module.js:12:51 - error NG6001: The class 'NgbRating' is listed in the declarations of the
NgModule 'NgbRatingModule', but is not a directive, a component, or a pipe. Either remove it from the NgModule's …
Run Code Online (Sandbox Code Playgroud)

angular-material ng-bootstrap angular

0
推荐指数
1
解决办法
4491
查看次数

如何在 angular 中默认选择 mat-list 中的第一项

我想知道如何在 angular 中默认选择 mat-list 的第一项。我尝试过但无法解决它。我的 mat-list 代码在这里

export class StationsListComponent implements OnInit {

  @Input() stations: Stations[];
  selectedStation: Stations;

  constructor() { }

  ngOnInit(): void {
    this.selectedStation = this.stations[0];
  }
}
Run Code Online (Sandbox Code Playgroud)
<mat-list role="list">
  <div *ngFor="let book of Books">
    <mat-list-item id="{{book.bookId}}" role="listitem" class="list-item" routerLink="/home/{{book.bookId}}" [routerLinkActive]="['is-active']">
      <div class="station-div">
          <div class="station-name">{{book.bookName}}</div>
          <div class="station-location">{{book.authorName}}</div>
      </div>
    </mat-list-item>
  </div>
</mat-list>
Run Code Online (Sandbox Code Playgroud)

typescript angular-material angular

0
推荐指数
1
解决办法
1730
查看次数