mirror of
https://gitee.com/bootx/dax-pay-ui.git
synced 2025-09-09 05:29:32 +00:00
feat: pageWrapper.vue加入sticky功能 (#3008)
This commit is contained in:
@@ -4,6 +4,7 @@
|
|||||||
:ghost="ghost"
|
:ghost="ghost"
|
||||||
:title="title"
|
:title="title"
|
||||||
v-bind="omit($attrs, 'class')"
|
v-bind="omit($attrs, 'class')"
|
||||||
|
:style="getHeaderStyle"
|
||||||
ref="headerRef"
|
ref="headerRef"
|
||||||
v-if="getShowHeader"
|
v-if="getShowHeader"
|
||||||
>
|
>
|
||||||
@@ -52,6 +53,7 @@
|
|||||||
import { omit } from 'lodash-es';
|
import { omit } from 'lodash-es';
|
||||||
import { PageHeader } from 'ant-design-vue';
|
import { PageHeader } from 'ant-design-vue';
|
||||||
import { useContentHeight } from '/@/hooks/web/useContentHeight';
|
import { useContentHeight } from '/@/hooks/web/useContentHeight';
|
||||||
|
import { useLayoutHeight } from '/@/layouts/default/content/useContentViewHeight';
|
||||||
import { PageWrapperFixedHeightKey } from '/@/enums/pageEnum';
|
import { PageWrapperFixedHeightKey } from '/@/enums/pageEnum';
|
||||||
|
|
||||||
defineOptions({
|
defineOptions({
|
||||||
@@ -63,6 +65,8 @@
|
|||||||
title: propTypes.string,
|
title: propTypes.string,
|
||||||
dense: propTypes.bool,
|
dense: propTypes.bool,
|
||||||
ghost: propTypes.bool,
|
ghost: propTypes.bool,
|
||||||
|
headerSticky: propTypes.bool,
|
||||||
|
headerStyle: Object as PropType<CSSProperties>,
|
||||||
content: propTypes.string,
|
content: propTypes.string,
|
||||||
contentStyle: {
|
contentStyle: {
|
||||||
type: Object as PropType<CSSProperties>,
|
type: Object as PropType<CSSProperties>,
|
||||||
@@ -112,6 +116,20 @@
|
|||||||
];
|
];
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const { headerHeightRef } = useLayoutHeight();
|
||||||
|
const getHeaderStyle = computed((): CSSProperties => {
|
||||||
|
const { headerSticky } = props;
|
||||||
|
if (!headerSticky) {
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
position: 'sticky',
|
||||||
|
top: `${unref(headerHeightRef)}px`,
|
||||||
|
...props.headerStyle,
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
const getShowHeader = computed(
|
const getShowHeader = computed(
|
||||||
() => props.content || slots?.headerContent || props.title || getHeaderSlots.value.length,
|
() => props.content || slots?.headerContent || props.title || getHeaderSlots.value.length,
|
||||||
);
|
);
|
||||||
|
Reference in New Issue
Block a user