feat: popup component support overlay blur effect (#5359)

This commit is contained in:
Netfan
2025-01-11 23:37:17 +08:00
committed by GitHub
parent cb9c8db5ba
commit 6719e2679f
12 changed files with 86 additions and 4 deletions

View File

@@ -25,6 +25,7 @@ const props = withDefaults(
closeClass?: ClassType;
modal?: boolean;
open?: boolean;
overlayBlur?: number;
showClose?: boolean;
zIndex?: number;
}
@@ -82,7 +83,12 @@ defineExpose({
<Transition name="fade">
<DialogOverlay
v-if="open && modal"
:style="{ zIndex, position }"
:style="{
zIndex,
position,
backdropFilter:
overlayBlur && overlayBlur > 0 ? `blur(${overlayBlur}px)` : 'none',
}"
@click="() => emits('close')"
/>
</Transition>

View File

@@ -17,6 +17,7 @@ interface SheetContentProps extends DialogContentProps {
class?: any;
modal?: boolean;
open?: boolean;
overlayBlur?: number;
side?: SheetVariants['side'];
zIndex?: number;
}
@@ -75,12 +76,23 @@ function onAnimationEnd(event: AnimationEvent) {
<template>
<DialogPortal :to="appendTo">
<Transition name="fade">
<SheetOverlay v-if="open && modal" :style="{ zIndex, position }" />
<SheetOverlay
v-if="open && modal"
:style="{
zIndex,
position,
backdropFilter:
overlayBlur && overlayBlur > 0 ? `blur(${overlayBlur}px)` : 'none',
}"
/>
</Transition>
<DialogContent
ref="contentRef"
:class="cn(sheetVariants({ side }), props.class)"
:style="{ zIndex, position }"
:style="{
zIndex,
position,
}"
@animationend="onAnimationEnd"
v-bind="{ ...forwarded, ...$attrs }"
>