gpt4 book ai didi

angular - 如何更改 Angular Material 排序图标

转载 作者:太空狗 更新时间:2023-10-29 17:47:44 30 4
gpt4 key购买 nike

我需要将默认箭头图标从 Angular Material matSort 更改为自定义箭头。

当前代码

 <mat-table #table [dataSource]="source" matSort (matSortChange)="sortData($event)" [matSortActive]="sort.active" [matSortDirection]="sort.direction">

有什么办法吗?

最佳答案

::ng-deep .mat-sort-header-arrow[style] {

// Hide default arrow stem
.mat-sort-header-stem {
display: none;
}
.mat-sort-header-indicator {
opacity: 1;
color: black;
font-weight: bold;

// Hide default arrow as its composed of left, right and middle
.mat-sort-header-pointer-left, .mat-sort-header-pointer-right, .mat-sort-header-pointer-middle {
display: none;
}
}
}

// My custom ascending arrow
[aria-sort="ascending"] {
::ng-deep .mat-sort-header-arrow {
.mat-sort-header-indicator {
&::before {
content: "\2191";
top: -1.6em;
position: absolute;
}
}
}
}

// My custom descending arrow
[aria-sort="descending"] {
::ng-deep .mat-sort-header-arrow {
.mat-sort-header-indicator {
&::before {
content: "\2193";
top: -2.4em;
position: absolute;
}
}
}
}

关于angular - 如何更改 Angular Material 排序图标,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51634592/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com