This commit is contained in:
oneao committed 2025-09-21 21:52:08 +08:00
1 parent d37d92996a
commit a8f3e58a27
25 files changed
+1401 -399

No files matched your search

@@ -1,23 +1,6 @@
// modalZIndex.ts
let zIndexBase = 1000
const modalStack: number[] = [] // 当前打开的 Modal zIndex
export function addModal() {
const zIndex = ++zIndexBase // 每次直接递增
modalStack.push(zIndex)
return zIndex
}
export function removeModal(zIndex: number) {
const idx = modalStack.indexOf(zIndex)
if (idx !== -1) {
modalStack.splice(idx, 1) // 只移出 stack,不回收 zIndex
}
}
export function getTopZIndex() {
return modalStack.length > 0 ? modalStack[modalStack.length - 1] : zIndexBase
}
export function getMaskZIndex() {
return modalStack.length > 0 ? modalStack[modalStack.length - 1] - 1 : zIndexBase
export function nextZIndex() {
return ++zIndexBase
}