Browse Source

no message

linwenxin 6 months ago
parent
commit
356bd82c44
1 changed files with 10 additions and 10 deletions
  1. 10 10
      src/components/logistics2/common-logistics.vue

+ 10 - 10
src/components/logistics2/common-logistics.vue

@@ -57,19 +57,19 @@ export default {
     downloadFile(url) {
       console.log(url)
       return new Promise((resolve, reject) => {
-        window.open(url, '_blank')
-        resolve(true)
-        // 提取文件名和类型
+        // window.open(url, '_blank')
+        // resolve(true)
+        // // 提取文件名和类型
         // const filename = url.split('/').pop().split('?')[0] // 获取文件名
         // const fileExtension = filename.split('.').pop().toLowerCase() // 获取文件扩展名
 
-        // // H5环境下下载
-        // const link = document.createElement('a')
-        // link.href = url
-        // link.download = `${filename}.${fileExtension}` // 设置下载文件名
-        // document.body.appendChild(link)
-        // link.click()
-        // document.body.removeChild(link)
+        // H5环境下下载
+        const link = document.createElement('a')
+        link.href = url
+        link.download = `${filename}.${fileExtension}` // 设置下载文件名
+        document.body.appendChild(link)
+        link.click()
+        document.body.removeChild(link)
 
         // // 判断当前平台
         // const platform = uni.getSystemInfoSync().platform