فهرست منبع

新增下载loading效果

wangfumin 3 ماه پیش
والد
کامیت
8f17b4ba1f
1فایلهای تغییر یافته به همراه10 افزوده شده و 1 حذف شده
  1. 10 1
      src/view/mediaLibrary/index.vue

+ 10 - 1
src/view/mediaLibrary/index.vue

@@ -113,7 +113,7 @@ import comPagination from "@/components/pagination/index.vue";
 import comHead from "@/components/head/index.vue";
 import { usePagging } from "@/hook/pagging";
 import { confirm } from "@/helper/message";
-import { ElMessage, ElMessageBox } from "element-plus";
+import { ElMessage, ElMessageBox, ElLoading } from "element-plus";
 import { getMediaPagging, uploadNewMedia, deleteMediaItem, Media, getGroupList, downloadMedia, downloadHash } from "@/store/mediaLibrary";
 import { ref, onMounted, watch } from "vue";
 import GroupManage from './groupManage.vue';
@@ -230,6 +230,15 @@ const editMediaHandler = async (row: Media) => {
 
 // 通用下载处理函数
 const handleDownload = async (row: Media, type: 'media' | 'hash') => {
+  // 显示全屏加载
+  const loading = ElLoading.service({
+    lock: true,
+    text: type === 'media' ? '正在下载文件...' : '正在下载Hash...',
+  });
+  // 关闭加载效果
+  setTimeout(() => {
+      loading.close();
+    }, 500); // 延迟500毫秒关闭,确保用户能看到加载效果
   try {
     let url = '';
     let fileName = '';