vue2中axios下载public文件夹下的文件

axios.get('Dev-Cpp_5.11_TDM-GCC_4.9.2_Setup.exe',{
            responseType: 'blob'
        }).then(res => {   
            console.log(res);
                const url = window.URL.createObjectURL(new Blob([res.data]));
                const link = document.createElement('a');
                link.href = url;
                link.setAttribute('download', 'xxxx.exe');
                document.body.appendChild(link);
                link.click();
        })

你可能感兴趣的:(vue,前端,javascript,html)