@/services/API.js
/* 获取远程协助状态 */
export function downLoadFiles(url, config) {
return get(url, config);
}
import { downLoadFiles } from '@/services/API.js';
export const downLoad = {
methods: {
downLoad(url) {
downLoadFiles(url, { responseType: 'blob' })
.then(res => {
const data = res.data;
var tempName='文件';
if (res.headers['content-disposition']) {
tempName = res.headers['content-disposition']
.split(';')[1]
.split('filename=')[1];
}
/* 兼容ie内核,360浏览器的兼容模式 */
if (window.navigator && window.navigator.msSaveOrOpenBlob) {
const blob = new Blob([data]);
window.navigator.msSaveOrOpenBlob(blob, tempName);
} else {
/* 火狐谷歌的文件下载方式 */