diff --git a/src/components/CrudTable.vue b/src/components/CrudTable.vue index 80ab8bc..967f6a7 100644 --- a/src/components/CrudTable.vue +++ b/src/components/CrudTable.vue @@ -44,6 +44,11 @@ const props = defineProps<{ maxHeight?: number }>() +// 表格实际使用的最大高度:显式 maxHeight 优先; +// stretch(整页列表)场景默认取视口高度 60%,保证表格与卡片一体、 +// 不产生页面级滚动栏(行多时表格内部滚动) +const tableMaxHeight = computed(() => props.maxHeight ?? (props.stretch ? Math.floor(window.innerHeight * 0.6) : undefined)) + const options: UseCrudTableOptions = { table: props.table, query: props.query, @@ -178,8 +183,8 @@ function renderUuid(value: unknown): string { border stripe round - :height="props.stretch ? '100%' : 'auto'" - :max-height="props.maxHeight" + :height="'auto'" + :max-height="tableMaxHeight" :row-config="{ isHover: true }" :column-config="{ resizable: true }" :checkbox-config="{ range: true }"