我需要将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。