首页 > 其他分享 >前端导出excal文件已经下载二进制流文件

前端导出excal文件已经下载二进制流文件

时间:2022-09-07 17:57:44浏览次数:75  
标签:文件 url excal 二进制 window link params data

导出excal文件

exportTable() {                 const params = {                     classId: id //参数                 }                 downFile(this.url, params).then((data) => {                     if (!data) {                         this.$message.warning('文件下载失败') // antd的提醒                         return                     }                     if (typeof window.navigator.msSaveBlob !== 'undefined') {                         window.navigator.msSaveBlob(new Blob([data], { type: 'application/vnd.ms-excel' }), '文件名' + '.xls')                     } else {                         let url = window.URL.createObjectURL(new Blob([data], { type: 'application/vnd.ms-excel' }))                         let link = document.createElement('a')                         link.style.display = 'none'                         link.href = url                         link.setAttribute('download', '文件名' + '.xls')                         document.body.appendChild(link)                         link.click()                         document.body.removeChild(link) // 下载完成移除元素                         window.URL.revokeObjectURL(url) // 释放掉blob对象                     }                 })
            },   export function downFile(url,parameter){   return axios({     url: url,     params: parameter,     method:'get' ,     responseType: 'blob'   }) }      

标签:文件,url,excal,二进制,window,link,params,data
From: https://www.cnblogs.com/moonof/p/16666672.html

相关文章

  • 计算机科学速成课第四课:二进制
    1、二进制的原理,存储单元MB/GB/TB解释0计算机中的二进制表示:单个数字1或0,1位二进制数字命名为位(bit),也称1比特。 1字节(byte)的概念:1byte=8bit,即1byte代......
  • python 将print内容打印到文件中
    python中print内容打印到文件中importsysfile=open("502log.txt",'a')sys.stdout=fileprint(time.asctime(),"开始请求。。。。。")file.close()这里将prin......
  • FASTQ | md5 | 原始文件保存、传输、完整性检验
     像fastq这样的原始文件是肯定不能丢掉的,必须保存在硬盘里或者放到ftp服务器上,以便之后再度调取分析。fastq保存时问题不大,但因为文件巨大,传输通常需要几小时-几天,非常......
  • 这个Python读取文件的方法,堪称天花板级别...
    前言嗨喽,大家好呀~这里是爱看美女的茜茜呐又到了学Python时刻~今天咱们来了解一下fileinput。说到fileinput,可能90%的码农表示没用过,甚至没有听说过。这不奇怪,因......
  • 【iOS工具】快速上传ipa文件到iTunes Connect
    Appuploader工具上传 通常打包的ipa文件上传到AppStore审核,要用到xcode或者ApplicationLoader上传只能在mac苹果机上传这里分享的这个ipa上传辅助工具......
  • vue如何回显已上传的文件并且修改
    我们知道当我们在表单里面上传多个文件时,我们希望将多个文件和表单中的对象一起传给后端,这时我们传给后端的文件就是file数组。而我们想要回显已上传的文件,应该是拿不到那......
  • 2文件管理命令
    一、相对路径和绝对路径相对路径./:代表目前所在的目录,也可以使用.表示。../:代表当前目录的上一层目录,也可以使用..表示绝对路径Linux:起始节点为根目录,比如:/root/......
  • 表 根据文件创建
    >>filename=fullfile(matlabroot,'bin','trycandelete.dat');>>filenamefilename='D:\madlaB\bin\trycandelete.dat'>>t=readtable(filename)t=4×5t......
  • 二进制安装mysql5.7
    1.安装相关包[root@CentOS8~]#yuminstalllibaionumactl-libs-y2.创建用户和用户组[root@CentOS8~]#groupaddmysql[root@CentOS8~]#useradd-r-gmysql......
  • TinyMCE粘贴word图片且图片文件自动上传功能
    ​ 1.编辑器修改(可选)1.1在 ueditor/config.json 中添加代码块    /* 上传word配置 */    "wordActionName":"wordupload",/* 执行上传视频的action......