当前位置:网站首页>【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);
});
},
边栏推荐
- What does open loop and closed loop mean?
- 实例讲解将Graph Explorer搬上JupyterLab
- Window sorting functions rank and deny for SQL data analysis_ rank、raw_ Number and lag, lead window offset function [usage sorting]
- LeetCode中等题题分享(5)
- leetcode96不同的二叉搜索樹
- BPR (Bayesian personalized sorting)
- GaussDB(for MySQL) :Partial Result Cache,通过缓存中间结果对算子进行加速
- What is ThreadLocal memory leak and how to solve it
- PWN attack and defense world cgpwn2
- Node——Egg 实现上传文件接口
猜你喜欢

Mysql database driver (JDBC Driver) jar package download

使用多线程Callable查询oracle数据库

牛客-练习赛101-推理小丑

Guide d'installation du serveur SQL

Promise和模块块化编程

The origin of usb-if Association and various interfaces

起床困难综合症(按位贪心)

UDS bootloader of s32kxxx bootloader

Halcon knowledge: an attempt of 3D reconstruction

数据分析方法论与前人经验总结【笔记干货】
随机推荐
Difficult to get up syndrome (bit by bit greed)
Selectively inhibiting learning bias for active sampling
LeetCode 0241. Design priority for arithmetic expressions - DFS
数据分析方法论与前人经验总结【笔记干货】
2023款雷克萨斯ES产品公布,这回进步很有感
Three methods of finding inverse numbers
GaussDB(for MySQL) :Partial Result Cache,通过缓存中间结果对算子进行加速
Download the online video m3u8 tutorial
启牛学院开户安全的吗?开户怎么开?
SQL Server 安裝指南
Ldr6035 smart Bluetooth audio can continuously charge and discharge mobile devices
微信小程序缓存过期时间的相关设置(推荐)
Selectively inhibiting learning bias for active sampling
[QT] test whether QT can connect to the database
一个实习生的CnosDB之旅
【CTF】bjdctf_2020_babystack2
Timer和ScheduledThreadPoolExecutor的区别
Practical calculation of the whole process of operational amplifier hysteresis comparator
SQL Server Installation Guide
Node——Egg 实现上传文件接口