diff --git a/packages/amis-ui/scss/components/_table.scss b/packages/amis-ui/scss/components/_table.scss index 56cf29db8b5..4f7947c118d 100644 --- a/packages/amis-ui/scss/components/_table.scss +++ b/packages/amis-ui/scss/components/_table.scss @@ -1032,7 +1032,11 @@ border-top: none; // 不然会导致拖动时顶部露出内容 &.#{$ns}Table-table--tableFillHeight { - min-height: 100%; // 为了让表格占满高度 + > tbody { + height: calc( + var(--Table-content-height) - var(--Table-thead-height) + ); + } } } diff --git a/packages/amis/src/renderers/Table/index.tsx b/packages/amis/src/renderers/Table/index.tsx index 484abfda01c..9c70077c508 100644 --- a/packages/amis/src/renderers/Table/index.tsx +++ b/packages/amis/src/renderers/Table/index.tsx @@ -952,6 +952,10 @@ export default class Table< )}px`; tableContent.style[heightField] = tableContentHeight; + tableContent.style.setProperty( + `--Table-content-${heightField}`, + tableContentHeight + ); } componentDidUpdate(prevProps: TableProps) {