fix: 修复弹窗抽屉被遮罩层覆盖的问题
移除布局容器的 z-index,改用 el-drawer 的 append-to-body 属性,调整 mesh 背景实现方式,避免形成 stacking context 导致弹窗被 body 上的遮罩层覆盖。更新相关样式、组件代码及迁移文档说明该重要约束。frontend_1.0.0
parent
279e6f861b
commit
6f1bed50de
|
|
@ -150,6 +150,29 @@ Element UI,且 vue-cli 4 依赖 PostCSS 7(Tailwind 3 需要 PostCSS 8)。
|
|||
`overflow` 恢复成 `visible`,否则 `:popper-append-to-body="false"` 的下拉面板
|
||||
(如 `finance/invoice/components/InvoiceInfoView.vue`、`ApplyInvoice.vue`)会被裁切。
|
||||
|
||||
## 弹窗 / 抽屉与 stacking context(重要约束)
|
||||
|
||||
若依的 `el-dialog` / `el-drawer` 默认 `modal-append-to-body` 为 true、
|
||||
`append-to-body` 为 false:遮罩 `.v-modal` 挂在 `<body>`(z-index 2000+),
|
||||
弹层节点却留在页面里。所以布局容器绝对不能形成 stacking context,
|
||||
否则弹层会被自己的遮罩盖住,表现为「点了详情之后整个页面都灰了」。
|
||||
|
||||
已经落地的约束:
|
||||
|
||||
- `.app-container`(`index.scss`)与 `#app .main-container`(`sidebar.scss`)
|
||||
只保留 `position: relative`,不要再加 `z-index`。
|
||||
- `.app-main` 的 sub2api mesh 背景写在元素自身 `background` 上
|
||||
(`background-attachment: fixed`),不再用铺满视口的 `::before` 浮层;
|
||||
当初正是为了盖住那层浮层才给上面两个容器补了 `z-index: 1`。
|
||||
- 弹层组件里再套弹层组件时,内层必须写 `append-to-body`
|
||||
(`finance/payable/components/EditForm.vue`、`finance/receivable/components/EditForm.vue`
|
||||
就是被 `DetailDrawer` 复用后才补的)。
|
||||
|
||||
自查办法:在浏览器里比较 `.v-modal` 与弹层根节点的 `z-index`,
|
||||
再用 `document.elementFromPoint()` 打在弹层中心;命中 `.v-modal`
|
||||
就说明又被遮住了,顺着 `getComputedStyle` 找出带 `z-index` / `transform` /
|
||||
`filter` 的祖先容器即可。
|
||||
|
||||
## 品牌 logo
|
||||
|
||||
侧边栏和登录页的 logo tile 现在用 `<ui-brand-mark>`(`src/components/ui/BrandMark.vue`)
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -124,9 +124,11 @@ aside {
|
|||
|
||||
//main-container全局样式
|
||||
// 对齐 sub2api 的 AppLayout: main { padding: p-4 md:p-6 lg:p-8 }
|
||||
// 注意:这里只能保留 position: relative,不要再加 z-index。
|
||||
// 页面里的 el-dialog / el-drawer 默认不 append-to-body,节点就在本容器内,
|
||||
// 一旦本容器形成 stacking context,挂在 body 上的遮罩层会盖到弹窗上面。
|
||||
.app-container {
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
padding: 16px;
|
||||
|
||||
@media (min-width: 768px) {
|
||||
|
|
|
|||
|
|
@ -6,12 +6,12 @@
|
|||
*/
|
||||
|
||||
#app {
|
||||
/* 同上:这里不能带 z-index,否则页面内的弹窗 / 抽屉会被 body 上的遮罩盖住 */
|
||||
.main-container {
|
||||
height: 100%;
|
||||
transition: margin-left 0.28s;
|
||||
margin-left: $base-sidebar-width;
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
.sidebarHide {
|
||||
|
|
|
|||
|
|
@ -48,24 +48,19 @@ export default {
|
|||
@import "~@/assets/styles/tokens-vars.scss";
|
||||
|
||||
.app-main {
|
||||
/* 内容区底色 + sub2api 的极淡 mesh 背景 */
|
||||
/* 内容区底色 + sub2api 的极淡 mesh 背景。
|
||||
mesh 直接画在自己的 background 上(background-attachment: fixed 保持视口锚定),
|
||||
不再用铺满视口的 ::before 浮层:那种做法要求页面内容再叠一层 z-index 才能盖住它,
|
||||
而 .app-container / .main-container 一旦有 z-index 就会生成 stacking context,
|
||||
把页面里的 el-dialog / el-drawer 困在里面,遮罩(挂在 body 上,z-index 2000+)
|
||||
反而盖到弹窗上面,看起来就是整个页面被蒙住。 */
|
||||
min-height: calc(100vh - #{$s2-header-height});
|
||||
width: 100%;
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
background-color: $s2-gray-50;
|
||||
}
|
||||
|
||||
.app-main::before {
|
||||
content: '';
|
||||
position: fixed;
|
||||
top: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
pointer-events: none;
|
||||
background-image: $s2-mesh-gradient;
|
||||
z-index: 0;
|
||||
background-attachment: fixed;
|
||||
}
|
||||
|
||||
.fixed-header + .app-main {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
<template>
|
||||
<el-drawer title="应付单详情" :visible.sync="internalVisible" :wrapper-closable="false" size="70%" :z-index="zIndex" @close="handleClose">
|
||||
<el-drawer title="应付单详情" :visible.sync="internalVisible" :wrapper-closable="false" size="70%" :z-index="zIndex" append-to-body @close="handleClose">
|
||||
<div class="dialog-body" v-loading="loading" element-loading-text="数据加载中...">
|
||||
<!-- Part 1: Details -->
|
||||
<div>
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
<template>
|
||||
<el-drawer title="修改销售应收单" :visible.sync="internalVisible" size="70%" :z-index="zIndex" @close="handleClose">
|
||||
<el-drawer title="修改销售应收单" :visible.sync="internalVisible" size="70%" :z-index="zIndex" append-to-body @close="handleClose">
|
||||
<div class="dialog-body">
|
||||
<!-- Part 1: Details -->
|
||||
<div>
|
||||
|
|
|
|||
Loading…
Reference in New Issue