-
+ >
+
+
+
+
(props, layout, store, table)
const debouncedUpdateLayout = debounce(doLayout, 50)
@@ -266,6 +300,7 @@ export default defineComponent({
context: table,
computedSumText,
computedEmptyText,
+ tableLayout,
}
},
})
diff --git a/packages/components/table/src/table/defaults.ts b/packages/components/table/src/table/defaults.ts
index 1fce463ef3..ad81d7a430 100644
--- a/packages/components/table/src/table/defaults.ts
+++ b/packages/components/table/src/table/defaults.ts
@@ -77,7 +77,7 @@ type CellStyle =
column: TableColumnCtx
columnIndex: number
}) => CSSProperties)
-
+type Layout = 'fixed' | 'auto'
interface TableProps {
data: T[]
size?: string
@@ -129,6 +129,7 @@ interface TableProps {
load?: (row: T, treeNode: TreeNode, resolve: (data: T[]) => void) => void
className?: string
style?: CSSProperties
+ tableLayout: Layout
}
interface Sort {
@@ -244,6 +245,10 @@ export default {
type: String,
default: '',
},
+ tableLayout: {
+ type: String as PropType,
+ default: 'fixed',
+ },
}
export type {
SummaryMethod,
diff --git a/packages/components/table/src/table/style-helper.ts b/packages/components/table/src/table/style-helper.ts
index 8c618a03d6..424a3f047e 100644
--- a/packages/components/table/src/table/style-helper.ts
+++ b/packages/components/table/src/table/style-helper.ts
@@ -218,6 +218,11 @@ function useStyle(
: ''
})
+ const tableLayout = computed(() => {
+ if (props.maxHeight) return 'fixed'
+ return props.tableLayout
+ })
+
const height = computed(() => {
const headerHeight = layout.headerHeight.value || 0
const bodyHeight = layout.bodyHeight.value
@@ -355,6 +360,7 @@ function useStyle(
resizeState,
doLayout,
tableBodyStyles,
+ tableLayout,
}
}