【发布时间】:2018-10-19 05:51:40
【问题描述】:
我需要从 ngx-datatable 标题单元格和正文单元格中删除填充。
我的实际解决方案如下所示:
.datatable-body-cell {
padding: 0 !important;
}
.datatable-header-cell {
padding-top: 0 !important;
padding-bottom: 0 !important;
}
calendar.component.scss
@Component({
templateUrl: './calendar.component.html',
styleUrls: ['./calendar.component.scss'],
encapsulation: ViewEncapsulation.None,
changeDetection: ChangeDetectionStrategy.OnPush,
})
calendar.component.ts
我遇到的问题是我需要禁用 ViewEncapsulation 覆盖 ngx-datatable CSS 类 datatable-body-cell 和 datatable-header-cell。因为我也在其他组件中使用了 ngx-datatable,所以当我导航到其他组件时,CSS 仍然被覆盖。只有当我刷新其他组件中的 CSS 时才会显示它应该显示的内容。
是否有任何其他可能性可以在组件中覆盖库的 CSS 而不会影响其他组件?
我正在使用 Angular 5。
【问题讨论】:
标签: css angular sass ngx-datatable