赞
踩
- fetch('https://example.com/api/download', {
- method: 'GET',
- headers: {
- 'Content-Type': 'application/json',
- },
- })
- .then(response => response.blob())
- .then(blob => {
- const url = window.URL.createObjectURL(blob);
- const a = document.createElement('a');
- a.href = url;
- a.download = 'file.pdf';
- document.body.appendChild(a);
- a.click();
- window.URL.revokeObjectURL(url);
- });
-
-
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。