封装请求 ,该请求为普通的get请求
该请求返回值为:
请求成功之后拼接URL地址下载文件
代码块
javascript
downTemplateRequest(activeKeys.value).then((res) => {
let url = `http://47.169.168.99:18888/media/${res.data.name}`;
var elink = document.createElement('a');
elink.style.display = 'none';
elink.href = url;
elink.setAttribute('download', res.data.name);
elink.click();
message.success('文件导出成功');
document.body.appendChild(elink);
elink.click();
document.body.removeChild(elink);
});