当前位置:网站首页>【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);
});
},
边栏推荐
- 九州云与英特尔联合发布智慧校园私有云框架,赋能教育新基建
- Node -- add compressed file
- Dongge cashes in and the boss retires?
- Is it safe to choose mobile phone for stock trading account opening in Beijing?
- 毕业季 | 华为专家亲授面试秘诀:如何拿到大厂高薪offer?
- 创业团队如何落地敏捷测试,提升质量效能?丨声网开发者创业讲堂 Vol.03
- 回顾数据脱敏系统
- Graduation season is both a farewell and a new beginning
- 2023款雷克萨斯ES产品公布,这回进步很有感
- GCC compilation
猜你喜欢
[opencv450] hog+svm and hog+cascade for pedestrian detection
Kuberntes cloud native combat high availability deployment architecture
Ldr6035 smart Bluetooth audio can continuously charge and discharge mobile devices
Shell process control
时间复杂度与空间复杂度
leetcode96不同的二叉搜索树
使用 ES 实现疫情地图或者外卖点餐功能(含代码及数据)
ThreadLocal内存泄漏是什么,怎么解决
LDR6035智能蓝牙音响可充可放(5.9.12.15.20V)快充快放设备充电
实例讲解将Graph Explorer搬上JupyterLab
随机推荐
Is it safe for qiniu college to open an account? How to open an account?
Intelligent operation and maintenance practice: banking business process and single transaction tracking
The origin of usb-if Association and various interfaces
How to type spaces in latex
What is the purpose of ERP project implementation plan?
下载在线视频 m3u8使用教程
USB-IF协会与各种接口的由来
LeetCode中等题题分享(5)
Asp . Text of automatic reply to NETCORE wechat subscription number
How do Lenovo computers connect Bluetooth headsets?
[CTF] bjdctf 2020 Bar _ Bacystack2
Flow control statement of SQL data analysis [if, case... When detailed]
SQL Server 安装指南
SQL数据分析之窗口排序函数rank、dense_rank、raw_number与lag、lead窗口偏移函数【用法整理】
时间复杂度与空间复杂度
@Valid参数校验不生效
Comprehensive usage and case questions of sub query of SQL data analysis [patient sorting]
Jielizhi, production line assembly link [chapter]
实例讲解将Graph Explorer搬上JupyterLab
数据库--SqlServer详解