Commit 5de954ba by ming4762 Committed by GitHub

fix: fix `LoginExpiredModal` in some cases, `message` may be obscured (#6086)

1 parent add1e61b
...@@ -36,6 +36,16 @@ const getZIndex = computed(() => { ...@@ -36,6 +36,16 @@ const getZIndex = computed(() => {
}); });
/** /**
* 排除ant-message和loading:9999的z-index
*/
const zIndexExcludeClass = ['ant-message', 'loading'];
function isZIndexExcludeClass(element: Element) {
return zIndexExcludeClass.some((className) =>
element.classList.contains(className),
);
}
/**
* 获取最大的zIndex值 * 获取最大的zIndex值
*/ */
function calcZIndex() { function calcZIndex() {
...@@ -44,7 +54,11 @@ function calcZIndex() { ...@@ -44,7 +54,11 @@ function calcZIndex() {
[...elements].forEach((element) => { [...elements].forEach((element) => {
const style = window.getComputedStyle(element); const style = window.getComputedStyle(element);
const zIndex = style.getPropertyValue('z-index'); const zIndex = style.getPropertyValue('z-index');
if (zIndex && !Number.isNaN(Number.parseInt(zIndex))) { if (
zIndex &&
!Number.isNaN(Number.parseInt(zIndex)) &&
!isZIndexExcludeClass(element)
) {
maxZ = Math.max(maxZ, Number.parseInt(zIndex)); maxZ = Math.max(maxZ, Number.parseInt(zIndex));
} }
}); });
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!