[英]Why is the download button using anchor tag in react js not working?
[英]Vue js Image force download not working by using anchor tag
我在vue js中使用Laravel。 我需要在瀏覽器上強制下載圖片,但現在可以使用了。
var link = document.createElement('a');
link.href = 'image/ab.jpg';
link.download = 'Download.jpg';
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
這適用於簡單的javascript,但適用於vue js,不起作用。 它只是在瀏覽器中打開圖像URL。
您確定您的代碼適用於簡單的javascript嗎?
下載屬性受同源策略的約束。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.