Files
smart-admin/smart-admin-web-javascript/src/store/modules/system/spin.js

46 lines
1.1 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/*
* loading
*
* @Author: 1024创新实验室-主任:卓大
* @Date: 2022-09-06 20:54:50
* @Wechat: zhuda1024
* @Email: lab1024@163.com
* @Copyright 1024创新实验室 https://1024lab.net Since 2012
*/
import { defineStore } from 'pinia';
import { smartSentry } from '/@/lib/smart-sentry.js';
export const useSpinStore = defineStore({
id: 'spin',
state: () => ({
loading: false,
}),
actions: {
hide() {
this.loading = false;
// 安全的DOM操作避免null引用错误
try {
const spins = document.querySelector('.ant-spin-nested-loading');
if (spins) {
spins.style.zIndex = '999';
}
} catch (error) {
smartSentry.captureError('Spin hide操作失败:', error);
}
},
show() {
this.loading = true;
// 安全的DOM操作避免null引用错误
try {
const spins = document.querySelector('.ant-spin-nested-loading');
if (spins) {
spins.style.zIndex = '1001';
}
} catch (error) {
smartSentry.captureError('Spin hide操作失败:', error);
}
},
},
});