Primeng:带有表格和其他元素的对话框中表格滚动条的高度错误

问题描述

当表格在嵌入其他元素的对话框中时,表格的滚动条过高。

查看以下链接下的示例: https://stackblitz.com/edit/primeng-tablescroll-dialog?file=src/app/app.component.ts

有没有人知道如何纠正这个问题。

错误

enter image description here

应该是:

enter image description here

解决方法

要删除外部滚动条,您可以在 styles.css 中添加以下内容:

.p-dialog-content {
  overflow-y: hidden !important;
}

如果您使用 .scss 而不是 .css,您将能够在本地组件(在您的情况下是 app.component.scss)中执行相同的操作,而不是在styles.css 这样做:

:host ::ng-deep .p-dialog-content {
  overflow-y: hidden !important;
}