Vue 跨域下载或读取文件 In Vue | 下载文件 1234567891011121314export async function download(file_url, file_name) { let res = await Axios({ method: "get", url: file_url, responseType: "blob" }); let newUrl = window.URL.createObjectURL(res.data); let a = document.createElement("a"); a.href = newUrl; a.download = file_name; a.click(); a.remove(); window.URL.revokeObjectURL(newUrl);} 读取文件 12345678export async function read(text_url) { let res = await Axios({ method: "get", url: text_url, responseType: "text" }); return res.data} -------------本文结束感谢您的阅读-------------