ソースを参照

feat:下载报错

ananzhusen 1 年間 前
コミット
9fe5793954
1 ファイル変更8 行追加4 行削除
  1. 8 4
      src/views/components/Header.vue

+ 8 - 4
src/views/components/Header.vue

@@ -1655,10 +1655,14 @@ const saveDownload = async () => {
     list.map(async (item: any) => {
       if (item.url) {
         //接口请求
-        const res: Blob = await axios.get(item.url.startsWith('/')?(cdn+item.url):item.url, {
-          responseType: 'blob',
-        });
-        zip.file(item.path, res, { createFolders: true });
+        try{
+          const res: Blob = await axios.get(item.url.startsWith('/')?(cdn+item.url):item.url, {
+            responseType: 'blob',
+          });
+          zip.file(item.path, res, { createFolders: true });
+        }catch(e){
+          console.log(e);
+        }
       } else if (item.data) {
         //直接写数据
         zip.file(item.path, item.data, { createFolders: true });