Update spin.js

修复菜单切换卡死问题;
This commit is contained in:
SuperHahaStar
2025-08-23 00:45:19 +08:00
committed by GitHub
parent 4b34c9960c
commit 76a24e2381

View File

@@ -18,13 +18,27 @@ export const useSpinStore = defineStore({
actions: {
hide() {
this.loading = false;
let spins = document.querySelector('.ant-spin-nested-loading');
spins.style.zIndex = 999;
// 安全的DOM操作避免null引用错误
try {
const spins = document.querySelector('.ant-spin-nested-loading');
if (spins) {
spins.style.zIndex = '999';
}
} catch (error) {
console.warn('Spin hide操作失败:', error);
}
},
show() {
this.loading = true;
let spins = document.querySelector('.ant-spin-nested-loading');
spins.style.zIndex = 1001;
// 安全的DOM操作避免null引用错误
try {
const spins = document.querySelector('.ant-spin-nested-loading');
if (spins) {
spins.style.zIndex = '1001';
}
} catch (error) {
console.warn('Spin show操作失败:', error);
}
},
},
});