1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
| import { ElLoading } from 'element-plus';
|
| export function useLoading(config?: { text: string; background?: string }) {
| return new Promise<() => void>((resolve, _reject) => {
| const loading = ElLoading.service({
| lock: true,
| text: config?.text ?? '加载中',
| background: config?.background ?? 'rgba(0, 0, 0, 0)',
| });
|
| resolve(() => {
| loading.close();
| });
| });
| }
|
|