vue从后台下载(2)

downloadFile(data) {
  let blob = new Blob([data], { type: "application/zip" });
  let url = window.URL.createObjectURL(blob);
  const link = document.createElement("a"); // 创建a标签
  link.href = url;
  link.download = "下载图片"; // 重命名文件
  link.click();
  URL.revokeObjectURL(url); // 释放内存
},

![](https://img-blog.csdnimg.cn/20201127142022949.png)


type:'application/zip'可以更改下载文件的类型,具体有以下这些类型



'doc'        => 'application/msword',

‘bin’        => ‘application/octet-stream’,
    ‘exe’        => ‘application/octet-stream’,
    ‘so’        => ‘application/octet-stream’,
    ‘dll’        => ‘application/octet-stream’,
    ‘pdf’        => ‘application/pdf’,
    ‘ai’        => ‘application/postscript’,
    ‘xls’        => ‘application/vnd.ms-excel’,
    ‘ppt’        => ‘application/vnd.ms-powerpoint’,
    ‘dir’        => ‘application/x-director’,
    ‘js’        => ‘application/x-javascript’,
    ‘swf’        => ‘application/x-shockwave-flash’,
    ‘xhtml’        => ‘application/xhtml+xml’,
    ‘xht’        => ‘application/xhtml+xml’,
    ‘zip’        => ‘application/zip’,
    ‘mid’        => ‘audio/midi’,
    ‘midi’        => ‘audio/midi’,
    ‘mp3’        => ‘audio/mpeg’,
    ‘rm’        => ‘audio/x-pn-realaudio’,
    ‘rpm’        => ‘audio/x-pn-realaudio-plugin’,
    ‘wav’        => ‘audio/x-wav’,
    ‘bmp’        => ‘image/bmp’,
    ‘gif’        => ‘image/gif’,
    ‘jpeg’        => ‘image/jpeg’,
    ‘jpg’        => ‘image/jpeg’,
    ‘png’        => ‘image/png’,
    ‘css’        => ‘text/css’,
    ‘html’        => ‘text/html’,
    ‘htm’        => ‘text/html’,
    ‘txt’        => ‘text/plain’,
    ‘xsl’        => ‘text/xml’,
    ‘xml’        => ‘text/xml’,
    ‘mpeg’        => ‘video/mpeg’,
    ‘mpg’        => ‘video/mpeg’,
    ‘avi’        => ‘video/x-msvideo’,
    ‘movie’        => ‘video/x-sgi-movie’,



### 计算机网络

*   HTTP 缓存

*   你知道 302 状态码是什么嘛?你平时浏览网页的过程中遇到过哪些 302 的场景?

*   HTTP 常用的请求方式,区别和用途?

*   HTTPS 是什么?具体流程

*   三次握手和四次挥手

*   你对 TCP 滑动窗口有了解嘛?

*   WebSocket与Ajax的区别

*   了解 WebSocket 嘛?

*   HTTP 如何实现长连接?在什么时候会超时?

*   TCP 如何保证有效传输及拥塞控制原理。

*   TCP 协议怎么保证可靠的,UDP 为什么不可靠?


![](https://img-blog.csdnimg.cn/img_convert/614771dc66a0fec7a3e33c2c7e1fa878.png)

**[开源分享:【大厂前端面试题解析+核心总结学习笔记+真实项目实战+最新讲解视频】](https://bbs.csdn.net/topics/618166371)**

### 算法

* 链表

* 字符串

* 数组问题

* 二叉树

* 排序算法

* 二分查找

* 动态规划

* BFS

* 栈

* DFS

* 回溯算法

  ![](https://img-blog.csdnimg.cn/img_convert/6c250b6200355d0edce85b970db267bd.png)
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值