是否可以更改Material-Table的水平滚动条的粗细?我尝试将scrollBarWidth属性和scrollPadding属性添加到表组件中的style属性,但没有成功。有没有可能改变宽度?

发布于 2020-05-30 20:21:59
您可以通过inspect元素对其进行修改,并找到特定的类
示例

通过将css放在material表类的elements中;您将提前看到结果,而无需重新加载页面。
如果您将其放入代码中,请使用:host ::ng-deep来反映您的更改。
示例
:host ::ng-deep .mat-menu-panel {
    min-width: 112px;
    max-width: 400px;
    overflow: auto;
 }发布于 2020-08-14 14:13:28
这不是对我最初问题的直接回答,但我设法通过覆盖页面上所有滚动条的样式来设置水平滚动条的宽度。
不管怎么说,看起来像这样,
::-webkit-scrollbar {
  width: 20px; /* <-- This sets the thickness of the VERTICAL scrollbar */
  height: 20px; /* <-- This sets the thickness of the HORIZONTAL scrollbar */
}我应该指出的是,这在Firefox或IE/Edge中不起作用。
发布于 2021-06-04 11:38:42
将此css添加到包装我的MaterialTable的div中,删除了预设的滚动条,并将其替换为带样式的滚动条。
* {
overflow-y: clip !important;
::-webkit-scrollbar {
  width: 12px;
  height: 12px;
}
::-webkit-scrollbar-track {
  border-radius: 5px;
}
::-webkit-scrollbar-thumb {
  border-radius: 5px;
}}
https://stackoverflow.com/questions/62102061
复制相似问题