首页 > Web开发 > 详细

又是基础,获取后台传过来的file进行拼接url下载路径

时间:2021-06-08 20:12:10      阅读:24      评论:0      收藏:0      [点我收藏+]
//url服务器地址
export const baseUrl = {
beta: {
outExcel: ‘http://127.0.0.1:10086/jicengzhili2.0/public/‘,// excel导出
goExcel: ‘http://127.0.0.1:10086/‘,// GO批量导入
},

//根据接口获取后台传过来的地址
export function download(data, options = {}) {
return service.request({
url: ‘reputation_export_error‘,
method: ‘get‘,
data,
...options,
});
}
//方法
download() {
download().then(res=>{
if (res.file){//如果file有地址
window.open(baseUrl.beta.outExcel + res.file);//点击打开拼接后的地址
}
this.$message.success(res.message,1);//如果没有数据则提示后台传过来的message提示,并显示1秒
});
},
//点击事件
<AButton  type="warning" @click="download">下载</AButton>

又是基础,获取后台传过来的file进行拼接url下载路径

原文:https://www.cnblogs.com/102605494time/p/14863845.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!