我想在 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) 角度版本:v9
我有一个按钮,它的垫子图标是一个指向左侧的箭头。我想知道 mat-icon 元素标签是否有任何属性可以让我控制箭头的方向,使其指向上方。
为了学习的目的,我更喜欢通过 angular.js 中的属性来学习如何做到这一点,而不是寻找另一个可以实现我想要的图标。
我在网上搜索,但找不到解决方案。因此这个问题。帮助表示赞赏。谢谢
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 中默认选择 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)