代码
// 下载视频地址 export function downloadVideoUrl(url) { return new Promise((resolve, reject) => { let xhr = new XMLHttpRequest(); xhr.open('GET', url); xhr.responseType = 'blob'; xhr.onload = function(e) { if (e.currentTarget.status == 200) { var link = document.createElement('a'); link.href = window.URL.createObjectURL(new Blob([xhr.response])); link.download = '视频.mp4'; link.click(); link.remove(); resolve(); } if(e.currentTarget.status != 200) reject(); }; xhr.send(); }); }