mirror of
https://github.com/m-xlsea/ruoyi-plus-soybean.git
synced 2025-09-24 07:49:47 +08:00
feat: 封装全屏加载
This commit is contained in:
@ -25,7 +25,7 @@ export function useDownload() {
|
||||
}
|
||||
|
||||
function download(url: string, params: any, fileName: string) {
|
||||
window.$loading?.startLoading();
|
||||
window.$loading?.startLoading('正在下载数据,请稍候...');
|
||||
const token = localStg.get('token');
|
||||
const clientId = import.meta.env.VITE_APP_CLIENT_ID;
|
||||
const now = new Date().getTime();
|
||||
@ -54,7 +54,7 @@ export function useDownload() {
|
||||
}
|
||||
|
||||
function oss(ossId: CommonType.IdType) {
|
||||
window.$loading?.startLoading();
|
||||
window.$loading?.startLoading('正在下载数据,请稍候...');
|
||||
const token = localStg.get('token');
|
||||
const clientId = import.meta.env.VITE_APP_CLIENT_ID;
|
||||
const url = `/resource/oss/download/${ossId}`;
|
||||
@ -77,7 +77,7 @@ export function useDownload() {
|
||||
}
|
||||
|
||||
function zip(url: string, fileName: string) {
|
||||
window.$loading?.startLoading();
|
||||
window.$loading?.startLoading('正在下载数据,请稍候...');
|
||||
const token = localStg.get('token');
|
||||
const clientId = import.meta.env.VITE_APP_CLIENT_ID;
|
||||
const now = new Date().getTime();
|
||||
|
25
src/hooks/common/loading.ts
Normal file
25
src/hooks/common/loading.ts
Normal file
@ -0,0 +1,25 @@
|
||||
import { ref } from 'vue';
|
||||
import { useLoading } from '@sa/hooks';
|
||||
|
||||
/** Content Loading */
|
||||
export default function useContentLoading() {
|
||||
const description = ref<string>('loading...');
|
||||
const loading = useLoading();
|
||||
|
||||
function startLoading(desc: string = 'loading...') {
|
||||
description.value = desc;
|
||||
loading.startLoading();
|
||||
}
|
||||
|
||||
function endLoading() {
|
||||
description.value = 'loading...';
|
||||
loading.endLoading();
|
||||
}
|
||||
|
||||
return {
|
||||
loading: loading.loading,
|
||||
description,
|
||||
startLoading,
|
||||
endLoading
|
||||
};
|
||||
}
|
Reference in New Issue
Block a user