diff --git a/src/views/videoDownload/videoDownload.vue b/src/views/videoDownload/videoDownload.vue index 47f427a..f5f884e 100644 --- a/src/views/videoDownload/videoDownload.vue +++ b/src/views/videoDownload/videoDownload.vue @@ -160,7 +160,7 @@ export default { }) .then(async res => { console.log(res, 'AccessTokenAccessToken'); - that.downloadFun(res, that.title); + await that.downloadFun(res, that.title); }); // console.log(videoData); @@ -211,17 +211,17 @@ export default { }, // 转blob下载 async downloadFun(blobFile, fileName) { - let blob = new Blob([blobFile], { + let blob = await new Blob([blobFile], { type: 'video/mp4' }); // console.log(blob); // if (window.navigator.msSaveOrOpenBlob) { // navigator.msSaveBlob(blob, fileName); // } else { - const reader = new FileReader(); - reader.readAsDataURL(blob); + const reader = await new FileReader(); + await reader.readAsDataURL(blob); // reader.readAsDataURL(blobFile); - reader.onloadend = function () { + reader.onloadend = await function () { const base64Data = reader.result; const link = document.createElement('a'); link.href = base64Data;