Skip to content

Commit 20c15f3

Browse files
authored
perf: page componet supports custom height offset for flexible content height … (#6081)
* perf: Page supports custom height offset for flexible content height control. 允许通过 height 属性调整页面内容高度计算。修改了 Page 组件以支持自定义高度偏移量,用于更灵活的内容高度控制。 * chore: typo * perf(page): replace height with heightOffset for flexible content sizing The `height` prop was replaced with `heightOffset` to better describe its purpose when used with `autoContentHeight`. The new prop allows custom offset values (in pixels) to adjust content area sizing, with clearer documentation.
1 parent 8aa7dab commit 20c15f3

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

packages/effects/common-ui/src/components/page/page.vue

+3-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ defineOptions({
1212
name: 'Page',
1313
});
1414
15-
const { autoContentHeight = false } = defineProps<PageProps>();
15+
const { autoContentHeight = false, heightOffset = 0 } =
16+
defineProps<PageProps>();
1617
1718
const headerHeight = ref(0);
1819
const footerHeight = ref(0);
@@ -24,7 +25,7 @@ const footerRef = useTemplateRef<HTMLDivElement>('footerRef');
2425
const contentStyle = computed<StyleValue>(() => {
2526
if (autoContentHeight) {
2627
return {
27-
height: `calc(var(${CSS_VARIABLE_LAYOUT_CONTENT_HEIGHT}) - ${headerHeight.value}px)`,
28+
height: `calc(var(${CSS_VARIABLE_LAYOUT_CONTENT_HEIGHT}) - ${headerHeight.value}px - ${typeof heightOffset === 'number' ? `${heightOffset}px` : heightOffset})`,
2829
overflowY: shouldAutoHeight.value ? 'auto' : 'unset',
2930
};
3031
}

packages/effects/common-ui/src/components/page/types.ts

+6
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,10 @@ export interface PageProps {
88
autoContentHeight?: boolean;
99
headerClass?: string;
1010
footerClass?: string;
11+
/**
12+
* Custom height offset value (in pixels) to adjust content area sizing
13+
* when used with autoContentHeight
14+
* @default 0
15+
*/
16+
heightOffset?: number;
1117
}

0 commit comments

Comments
 (0)