🐞 fix(web): 部分组件层级错乱

This commit is contained in:
小吾立 2024-07-26 13:27:17 +08:00
parent cc46360396
commit c71b629e59
3 changed files with 17 additions and 7 deletions

View File

@ -1,5 +1,5 @@
:root {
--notification-z-index: 1050;
--increase-z-index: 1050;
}
.search-box {
margin-bottom: 0 !important;
@ -18,6 +18,8 @@
white-space: normal;
}
.ant-notification {
z-index: var(--notification-z-index) !important;
.ant-notification,
.ant-select-dropdown,
.ant-dropdown {
z-index: var(--increase-z-index) !important;
}

View File

@ -24,7 +24,7 @@ export const jpomWindow = () => {
export const $message = message
const updateNotificationZIndex = () => {
document.documentElement.style.setProperty('--notification-z-index', String(increaseZIndex()))
//document.documentElement.style.setProperty('--increase-z-index', String(increaseZIndex()))
}
export const $notification = {
...notification,
@ -50,7 +50,7 @@ export const $notification = {
}
}
// --notification-z-index
// --increase-z-index
//
export const $confirm = (props: ModalFuncProps) => {

View File

@ -17,9 +17,17 @@ export function getHashQuery() {
return querys
}
const zIndexStart = 1009
// root 元素
const root = document.documentElement
// 获取计算后的样式
// https://developer.mozilla.org/en-US/docs/Web/API/Window/getComputedStyle
const style = getComputedStyle(root)
const zIndexStart = Number(style.getPropertyValue('--increase-z-index'))
let incCount = 0
export function increaseZIndex() {
return zIndexStart + incCount++
const useIndex = zIndexStart + incCount++
// 设置全局变量,避免全局提示,下拉框,下拉菜单显示错位
document.documentElement.style.setProperty('--increase-z-index', String(zIndexStart + incCount))
return useIndex
}