feat(projects): add full screen watermark

This commit is contained in:
paynezhuang
2024-07-29 16:10:32 +08:00
parent a9dce21878
commit 38cc2872ea
11 changed files with 114 additions and 3 deletions

View File

@@ -25,7 +25,9 @@ const props = withDefaults(defineProps<AdminLayoutProps>(), {
siderCollapsedWidth: 64,
footerVisible: true,
footerHeight: 48,
rightFooter: false
rightFooter: false,
watermarkVisible: true,
watermarkText: 'SoybeanAdmin'
});
interface Emits {
@@ -48,6 +50,8 @@ type Slots = {
sider?: SlotFn;
/** Footer */
footer?: SlotFn;
/** Watermark */
watermark?: SlotFn;
};
const slots = defineSlots<Slots>();
@@ -60,6 +64,7 @@ const showTab = computed(() => Boolean(slots.tab) && props.tabVisible);
const showSider = computed(() => !props.isMobile && Boolean(slots.sider) && props.siderVisible);
const showMobileSider = computed(() => props.isMobile && Boolean(slots.sider) && props.siderVisible);
const showFooter = computed(() => Boolean(slots.footer) && props.footerVisible);
const showWatermark = computed(() => Boolean(slots.watermark) && props.watermarkVisible);
// scroll mode
const isWrapperScroll = computed(() => props.scrollMode === 'wrapper');
@@ -230,6 +235,11 @@ function handleClickMask() {
:class="[style['layout-footer-placement']]"
></div>
</template>
<!-- Watermark -->
<template v-if="showWatermark">
<slot name="watermark"></slot>
</template>
</div>
</div>
</template>

View File

@@ -132,6 +132,22 @@ export interface AdminLayoutFooterConfig {
rightFooter?: boolean;
}
/** Watermark config */
export interface AdminLayoutWatermarkConfig {
/**
* Whether watermark is visible
*
* @default: true
*/
watermarkVisible?: boolean;
/**
* Watermark text
*
* @default: SoybeanAdmin
*/
watermarkText?: string;
}
/**
* Layout mode
*
@@ -156,7 +172,8 @@ export interface AdminLayoutProps
AdminLayoutTabConfig,
AdminLayoutSiderConfig,
AdminLayoutContentConfig,
AdminLayoutFooterConfig {
AdminLayoutFooterConfig,
AdminLayoutWatermarkConfig {
/**
* Layout mode
*