From 0e1a85fb7d60b80750994caeafcccca63d1db7af Mon Sep 17 00:00:00 2001 From: jxxghp Date: Mon, 31 Aug 2026 08:20:53 +0800 Subject: [PATCH] =?UTF-8?q?fix=20glass=E8=83=8C=E6=99=AF=E6=A8=A1=E7=B3=8A?= =?UTF-8?q?=E5=BB=B6=E8=BF=9F=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../__tests__/glassOverlayMaterial.spec.ts | 9 ++++--- src/styles/themes/glass.scss | 27 +++++++++++++++---- 2 files changed, 28 insertions(+), 8 deletions(-) diff --git a/src/styles/__tests__/glassOverlayMaterial.spec.ts b/src/styles/__tests__/glassOverlayMaterial.spec.ts index a9d05cea..eda379ee 100644 --- a/src/styles/__tests__/glassOverlayMaterial.spec.ts +++ b/src/styles/__tests__/glassOverlayMaterial.spec.ts @@ -138,14 +138,17 @@ describe('glass overlay material styles', () => { expect(styles).toContain("&[data-glass-appearance='tinted'] .workflow-share-card") }) - it('composites glass dialogs at their final geometry instead of resampling a scaled backdrop', () => { + it('paints glass menus and dialogs with their final backdrop material on the first frame', () => { const styles = readFileSync(resolve(cwd(), 'src/styles/themes/glass.scss'), 'utf8') expect(styles).toMatch( - /\.v-overlay__content\.mp-dialog-transition-enter-active[\s\S]*?transition:\s*opacity 120ms var\(--mp-motion-ease-standard\);/, + /:is\(\.v-menu, \.v-dialog\) > \.v-overlay__content\[class\*='-transition-enter-active'\]\s*\{[\s\S]*?opacity:\s*1 !important;[\s\S]*?transform:\s*none !important;[\s\S]*?transition:\s*none !important;/, ) expect(styles).toMatch( - /\.v-overlay__content\.mp-dialog-transition-enter-from[\s\S]*?filter:\s*none;[\s\S]*?transform:\s*none;/, + /:is\(\.v-menu, \.v-dialog\) > \.v-overlay__content\[class\*='-transition-enter-from'\]\s*\{[\s\S]*?opacity:\s*1 !important;[\s\S]*?transform:\s*none !important;/, + ) + expect(styles).toMatch( + /:is\(\.v-menu, \.v-dialog\) > \.v-overlay__scrim\.fade-transition-enter-active,[\s\S]*?opacity:\s*var\(--v-overlay-opacity, 0\.32\) !important;[\s\S]*?transition:\s*none !important;/, ) }) diff --git a/src/styles/themes/glass.scss b/src/styles/themes/glass.scss index e5539e15..51e75b66 100644 --- a/src/styles/themes/glass.scss +++ b/src/styles/themes/glass.scss @@ -646,10 +646,29 @@ html[data-theme='glass'] { } } - // 弹层材质按最终几何一次合成,避免 transform/filter 动画反复重采样背景。 - .v-overlay__content.mp-dialog-transition-enter-active, + // 菜单与弹窗的材质从首个绘制帧就使用最终状态,避免父层淡入让背景模糊看起来延迟生效。 + :is(.v-menu, .v-dialog) > .v-overlay__content[class*='-transition-enter-active'] { + filter: none !important; + opacity: 1 !important; + transform: none !important; + transition: none !important; + will-change: auto; + } + + :is(.v-menu, .v-dialog) > .v-overlay__content[class*='-transition-enter-from'] { + filter: none !important; + opacity: 1 !important; + transform: none !important; + } + + :is(.v-menu, .v-dialog) > .v-overlay__scrim.fade-transition-enter-active, + :is(.v-menu, .v-dialog) > .v-overlay__scrim.fade-transition-enter-from { + opacity: var(--v-overlay-opacity, 0.32) !important; + transition: none !important; + } + + // 关闭弹窗时仍保留轻量淡出,但不再缩放需要重新采样的材质层。 .v-overlay__content.mp-dialog-transition-leave-active, - .v-overlay__content.dialog-transition-enter-active, .v-overlay__content.dialog-transition-leave-active { filter: none; transform: none; @@ -657,9 +676,7 @@ html[data-theme='glass'] { will-change: opacity; } - .v-overlay__content.mp-dialog-transition-enter-from, .v-overlay__content.mp-dialog-transition-leave-to, - .v-overlay__content.dialog-transition-enter-from, .v-overlay__content.dialog-transition-leave-to { filter: none; transform: none;