From cd2c2f66d76c4c1af5a15efdd4316b79f49c3169 Mon Sep 17 00:00:00 2001 From: luobisheng <727299681@qq.com> Date: 星期四, 17 十一月 2022 16:27:34 +0800 Subject: [PATCH] 短信修改 --- src/utils/helper.js | 12 ++++++------ 1 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/utils/helper.js b/src/utils/helper.js index 77baab7..621af9a 100644 --- a/src/utils/helper.js +++ b/src/utils/helper.js @@ -2,7 +2,7 @@ // 娣辨嫹璐� export function deepClone(obj) { let objClone = Array.isArray(obj) ? [] : {}; - if (obj && typeof obj === 'object' && obj != null) { + if (obj && typeof obj === 'object') { for (let key in obj) { if (obj.hasOwnProperty(key)) { if (obj[key] && typeof obj[key] === 'object') { @@ -49,18 +49,18 @@ // data: 鏂囦欢, contentDisposition锛氳姹傚ご涓枃浠剁殑鍚嶅瓧 // 榛樿涓嶇敤淇敼锛岀洿鎺ュ皢杩斿洖鐨剅es浼犲叆鍗冲彲 export function downloadFile(res) { - const blob = new Blob([res.data], { type: '.xlsx' }); + const blob = new Blob([res.data], { type: 'application/octet-stream' }); const fileName = res.contentDisposition.split(`''`)[1]; if (window.navigator && window.navigator.msSaveBlob) { - navigator.msSaveBlob(blob, fileName); + window.navigator.msSaveBlob(blob, fileName); } else { const link = document.createElement('a'); link.style.display = 'none'; - link.href = URL.createObjectURL(blob); - link.setAttribute('download', decodeURI(fileName)); + link.href = window.URL.createObjectURL(blob); + link.download = decodeURI(fileName); document.body.appendChild(link); link.click(); - URL.revokeObjectURL(link.href); + window.URL.revokeObjectURL(link.href); document.body.removeChild(link); } } -- Gitblit v1.8.0