Skip to content

Commit bd4c754

Browse files
committed
chore: add header-sticky support
1 parent 35c8d7c commit bd4c754

File tree

1 file changed

+20
-1
lines changed
  • packages/effects/common-ui/src/page

1 file changed

+20
-1
lines changed

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

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
<script setup lang="ts">
22
import type { Props } from './page.ts';
33
4+
import { computed, type CSSProperties } from 'vue';
5+
46
import PageFooter from './page-footer.vue';
57
import PageHeader from './page-header.vue';
68
@@ -14,11 +16,28 @@ const props = withDefaults(defineProps<Props>(), {
1416
showHeader: true,
1517
title: '',
1618
});
19+
20+
const headerStyle = computed((): CSSProperties => {
21+
const { headerSticky } = props;
22+
if (!headerSticky) {
23+
return {};
24+
}
25+
26+
return {
27+
position: 'sticky',
28+
top: 0,
29+
zIndex: 99,
30+
};
31+
});
1732
</script>
1833

1934
<template>
2035
<div class="relative h-full">
21-
<PageHeader v-if="props.showHeader" :title="props.title">
36+
<PageHeader
37+
v-if="props.showHeader"
38+
:style="headerStyle"
39+
:title="props.title"
40+
>
2241
<template #default>
2342
<slot name="headerContent"></slot>
2443
</template>

0 commit comments

Comments
 (0)