Sfoglia il codice sorgente

fix:“优化日志功能文件名称”

soobin 1 anno fa
parent
commit
861ed10f5b
1 ha cambiato i file con 3 aggiunte e 3 eliminazioni
  1. 3 3
      src/views/device/viewLogs/index.vue

+ 3 - 3
src/views/device/viewLogs/index.vue

@@ -210,11 +210,11 @@ export default ({
     const downloadFile = async () => {
       // 文件链接
       const fileUrl = 'http://qiniuyun.sunzee.com.cn/log/' + fileName.value;
+      // 文件名
+      const newFileName = fileName.value;
       try {
         const response = await fetch(fileUrl);
         console.log('response', response);
-        // 获取文件名
-        const fileName = "20231221-1702000724598953359968463.txt";
 
         // 将文件内容创建为Blob
         const fileBlob = await response.blob();
@@ -222,7 +222,7 @@ export default ({
         // 创建一个下载链接
         const downloadLink = document.createElement('a');
         downloadLink.href = URL.createObjectURL(fileBlob);
-        downloadLink.download = fileName;
+        downloadLink.download = newFileName;
 
         // 模拟点击下载链接
         document.body.appendChild(downloadLink);