From 76a24e23819816bb48734f6fe410c3a9a6a43563 Mon Sep 17 00:00:00 2001 From: SuperHahaStar <73262891+BeeThor@users.noreply.github.com> Date: Sat, 23 Aug 2025 00:45:19 +0800 Subject: [PATCH] Update spin.js MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修复菜单切换卡死问题; --- .../src/store/modules/system/spin.js | 22 +++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/smart-admin-web-javascript/src/store/modules/system/spin.js b/smart-admin-web-javascript/src/store/modules/system/spin.js index fd12a61..fb9b811 100644 --- a/smart-admin-web-javascript/src/store/modules/system/spin.js +++ b/smart-admin-web-javascript/src/store/modules/system/spin.js @@ -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); + } }, }, });