From 051f38243ab071b62aef796c6fa6eff9a02ffcc9 Mon Sep 17 00:00:00 2001 From: douzhuo <17611323298@163.com> Date: Mon, 23 May 2022 18:45:25 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BF=AE=E6=94=B9=E4=BF=9D?= =?UTF-8?q?=E5=AD=98=E9=9F=B3=E9=A2=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/Receive/index.vue | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/src/views/Receive/index.vue b/src/views/Receive/index.vue index 8279435..13f6ade 100644 --- a/src/views/Receive/index.vue +++ b/src/views/Receive/index.vue @@ -1859,24 +1859,27 @@ export default { .then((res) => { console.log(res, 'adasdjslakd') let blob = new Blob([res], { type: "audio/*" }); - let date = new Date(); - let time = date.toLocaleDateString(); + saveAs(blob, "audio.mp3"); - const a = document.createElement('a'); - document.body.appendChild(a) - a.style.display = 'none' - // 使用获取到的blob对象创建的url - const url = window.URL.createObjectURL(res); - a.href = url; - // 指定下载的文件名,就‘’写默认的下载名字。不指定他就根据上传名直接下载了宝。 - a.download = ''; - a.click(); - document.body.removeChild(a) - // 移除blob对象的url - window.URL.revokeObjectURL(url); + // let date = new Date(); + // let time = date.toLocaleDateString(); + + // const a = document.createElement('a'); + // document.body.appendChild(a) + // a.style.display = 'none' + // // 使用获取到的blob对象创建的url + // const url = window.URL.createObjectURL(res); + // a.href = url; + // // 指定下载的文件名,就‘’写默认的下载名字。不指定他就根据上传名直接下载了宝。 + // a.download = ''; + // a.click(); + // document.body.removeChild(a) + // // 移除blob对象的url + // window.URL.revokeObjectURL(url); }) .catch((error) => { console.log(error); + this.$message.error('请求超时') }); }, },