Skip to content

Commit daf83e3

Browse files
committed
chore: remove useless fixedHeader prop for Page
1 parent bac0275 commit daf83e3

File tree

4 files changed

+19
-50
lines changed

4 files changed

+19
-50
lines changed

docs/src/components/layout-ui/page.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ outline: deep
2626
| headerClass | 头部区域的class | `string` | - | - |
2727
| footerClass | 底部区域的class | `string` | - | - |
2828
| autoContentHeight | 自动调整内容区域的高度 | `boolean` | `false` | - |
29-
| ~~fixedHeader~~ | ~~固定头部在页面内容区域顶部,在滚动时保持可见~~ | `boolean` | `false` | 待实现 |
3029

3130
::: tip 注意
3231

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

Lines changed: 19 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,7 @@
11
<script setup lang="ts">
2-
import {
3-
computed,
4-
nextTick,
5-
onMounted,
6-
ref,
7-
type StyleValue,
8-
useTemplateRef,
9-
} from 'vue';
2+
import { computed, nextTick, onMounted, ref, useTemplateRef } from 'vue';
103
11-
import { preferences } from '@vben-core/preferences';
4+
import { CSS_VARIABLE_LAYOUT_CONTENT_HEIGHT } from '@vben/constants';
125
import { cn } from '@vben-core/shared/utils';
136
147
interface Props {
@@ -19,8 +12,6 @@ interface Props {
1912
* 根据content可见高度自适应
2013
*/
2114
autoContentHeight?: boolean;
22-
/** 头部固定(暂未实现) */
23-
fixedHeader?: boolean;
2415
headerClass?: string;
2516
footerClass?: string;
2617
}
@@ -29,13 +20,7 @@ defineOptions({
2920
name: 'Page',
3021
});
3122
32-
const {
33-
contentClass = '',
34-
description = '',
35-
autoContentHeight = false,
36-
title = '',
37-
fixedHeader = false,
38-
} = defineProps<Props>();
23+
const { autoContentHeight = false } = defineProps<Props>();
3924
4025
const headerHeight = ref(0);
4126
const footerHeight = ref(0);
@@ -44,22 +29,11 @@ const shouldAutoHeight = ref(false);
4429
const headerRef = useTemplateRef<HTMLDivElement>('headerRef');
4530
const footerRef = useTemplateRef<HTMLDivElement>('footerRef');
4631
47-
const headerStyle = computed<StyleValue>(() => {
48-
return fixedHeader
49-
? {
50-
position: 'sticky',
51-
zIndex: 200,
52-
top:
53-
preferences.header.mode === 'fixed' ? 'var(--vben-header-height)' : 0,
54-
}
55-
: undefined;
56-
});
57-
5832
const contentStyle = computed(() => {
5933
if (autoContentHeight) {
6034
return {
6135
height: shouldAutoHeight.value
62-
? `calc(var(--vben-content-height) - ${headerHeight.value}px - ${footerHeight.value}px)`
36+
? `calc(var(${CSS_VARIABLE_LAYOUT_CONTENT_HEIGHT}) - ${headerHeight.value}px)`
6337
: '0',
6438
// 'overflow-y': shouldAutoHeight.value?'auto':'unset',
6539
};
@@ -97,28 +71,26 @@ onMounted(() => {
9771
ref="headerRef"
9872
:class="
9973
cn(
100-
'bg-card relative px-6 py-4',
74+
'bg-card border-border relative flex items-end border-b px-6 py-4',
10175
headerClass,
102-
fixedHeader
103-
? 'border-border border-b transition-all duration-200'
104-
: '',
10576
)
10677
"
107-
:style="headerStyle"
10878
>
109-
<slot name="title">
110-
<div v-if="title" class="mb-2 flex text-lg font-semibold">
111-
{{ title }}
112-
</div>
113-
</slot>
79+
<div class="flex-auto">
80+
<slot name="title">
81+
<div v-if="title" class="mb-2 flex text-lg font-semibold">
82+
{{ title }}
83+
</div>
84+
</slot>
11485

115-
<slot name="description">
116-
<p v-if="description" class="text-muted-foreground">
117-
{{ description }}
118-
</p>
119-
</slot>
86+
<slot name="description">
87+
<p v-if="description" class="text-muted-foreground">
88+
{{ description }}
89+
</p>
90+
</slot>
91+
</div>
12092

121-
<div v-if="$slots.extra" class="absolute bottom-4 right-4">
93+
<div v-if="$slots.extra">
12294
<slot name="extra"></slot>
12395
</div>
12496
</div>
@@ -132,8 +104,8 @@ onMounted(() => {
132104
ref="footerRef"
133105
:class="
134106
cn(
135-
footerClass,
136107
'bg-card align-center absolute bottom-0 left-0 right-0 flex px-6 py-4',
108+
footerClass,
137109
)
138110
"
139111
>

playground/src/views/examples/form/basic.vue

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,6 @@ function handleSetFormValue() {
362362
<Page
363363
content-class="flex flex-col gap-4"
364364
description="表单组件基础示例,请注意,该页面用到的参数代码会添加一些简单注释,方便理解,请仔细查看。"
365-
fixed-header
366365
header-class="pb-0"
367366
title="表单组件"
368367
>

playground/src/views/examples/modal/index.vue

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,6 @@ function openFormModal() {
7777
<template>
7878
<Page
7979
description="弹窗组件常用于在不离开当前页面的情况下,显示额外的信息、表单或操作提示,更多api请查看组件文档。"
80-
fixed-header
8180
title="弹窗组件示例"
8281
>
8382
<template #extra>

0 commit comments

Comments
 (0)