所以我已经实现了使用 axios 从 s3 存储桶获取文件 URL,并且在控制台中我可以单击 url 并下载文件,我的问题是如何在不单击控制台 url 的情况下实现它?所以当我从客户端按下下载按钮时,它也会继续自动点击 url 作为响应
这是控制台中显示的内容 img
这是我获取网址的代码:
exportProductPrice(priceSetID, productSalability, productCategoryStatus) {
this.$http.get("/price/product_price/export?export=1", {params:{
// embeds:'price_set_id,product.salability,product.category.status',
conditions: priceSetID + productSalability + productCategoryStatus
}}).then(response => {
console.log(response.data.file,'hit')
var fileURL = window.URL.createObjectURL(new Blob([responses.data]));
var fileLink = document.createElement('a');
fileLink.href = fileURL;
fileLink.setAttribute('download');
document.body.appendChild(fileLink);
fileLink.click();
}).catch((err) => {
return Promise.reject({ Error: 'something went wrong', err});
});
},