当前位置:网站首页>【js通过url下载文件】
【js通过url下载文件】
2022-07-02 00:30:00 【six-double-seven】
js通过url下载文件
- 下载文件的代码如下
exportTable(){
api.exportOrder(this.query)
.then(res => {
setTimeout(() => {
if (res && res.code === 1) {
const a = document.createElement('a');
a.href = res.exportUrl;
a.download = '文件名称';
document.body.appendChild(a);
a.click();
URL.revokeObjectURL(res.exportUrl);
a.remove();
this.$Message.success("下载完成");
}else {
this.$Message.error(res.msg);
}
}, 1000);
})
.catch(err => {
this.$Message.error('导出失败:' + err);
});
},
边栏推荐
- Soft exam information system project manager_ Compiled abbreviations of the top ten management processes to help memory recitation - -- software test advanced information system project manager 054
- Use the htaccess file to prohibit the script execution permission in the directory
- Windows installation WSL (II)
- 起床困难综合症(按位贪心)
- Node -- add compressed file
- 回顾数据脱敏系统
- Leetcode skimming: stack and queue 03 (valid parentheses)
- Node——生成微信权限验证配置
- 【mysql 07】GPG key retrieval failed: “Couldn‘t open file /etc/pki/rpm-gpg/RPM-GPG-KEY-mysql-2022“
- SQL数据分析之子查询的综合用法和案例题【耐心整理】
猜你喜欢
![[opencv450] hog+svm and hog+cascade for pedestrian detection](/img/55/cdf0bb8231ee59e34c8d5a9d6def23.png)
[opencv450] hog+svm and hog+cascade for pedestrian detection

What does open loop and closed loop mean?

It's nothing to be utilitarian!

Graduation season | Huawei experts teach the interview secret: how to get a high paying offer from a large factory?

UDS bootloader of s32kxxx bootloader
![Comprehensive usage and case questions of sub query of SQL data analysis [patient sorting]](/img/24/d9a48a0f76cde65421edda04d0f854.png)
Comprehensive usage and case questions of sub query of SQL data analysis [patient sorting]

JS——图片转base码 、base转File对象
![Jielizhi, production line assembly link [chapter]](/img/f8/20c41ffe9468d59bf25ea49f73751e.png)
Jielizhi, production line assembly link [chapter]
![Flow control statement of SQL data analysis [if, case... When detailed]](/img/7b/eabb0700936d34a3a145737580be88.png)
Flow control statement of SQL data analysis [if, case... When detailed]

ThreadLocal内存泄漏是什么,怎么解决
随机推荐
How to type spaces in latex
Digital transformation has a long way to go, so how to take the key first step
UDS bootloader of s32kxxx bootloader
Is it safe for qiniu college to open an account? How to open an account?
微信小程序缓存过期时间的相关设置(推荐)
股票开户哪个证券公司比较安全
ERP项目施行计划的目的是什么?
Timer和ScheduledThreadPoolExecutor的区别
Node——生成微信权限验证配置
[CTF] bjdctf 2020 Bar _ Bacystack2
[embedded system course design] a single key controls the LED light
Jielizhi, production line assembly link [chapter]
When installing mysql, there are two packages: Perl (data:: dumper) and Perl (JSON)
Leetcode skimming: binary tree 01 (preorder traversal of binary tree)
毕业季 | 华为专家亲授面试秘诀:如何拿到大厂高薪offer?
Promise和模块块化编程
Linux centos7 installation Oracle11g super perfect novice tutorial
Vue force cleaning browser cache
JS——图片转base码 、base转File对象
Leetcode skimming: stack and queue 04 (delete all adjacent duplicates in the string)