因为业务需要,须要用到导出excel性能,后盾传回的是文件流

因而前端须要做点儿解决能力导出
要害代码

this.$ajax.post('/ship/order/exportOrder',param,{ responseType: 'arraybuffer' }).then(res=>{    if (window.navigator.msSaveOrOpenBlob) {        navigator.msSaveBlob(blob);    } else {        const aLink = document.createElement('a');        const blob = new Blob([res.data],{type: "application/vnd.ms-excel"});        // 创立一个以后文件的内存URL        const _href = URL.createObjectURL(blob);        aLink.style.display = 'none';        aLink.href = _href;        document.body.appendChild(aLink);        aLink.setAttribute('download', '订单数据.xlsx');        aLink.click();        document.body.removeChild(aLink);        // 手动开释创立的URL对象所占内存        URL.revokeObjectURL(_href);    }})

下面代码的关键在于 { responseType: 'arraybuffer' } 这个指定类型,之前遗记增加这个参数,尽管最初也能导出一个excel文件,然而关上的时候却失去报错 "此文件损坏无奈加载";
所以这个不能少