zoukankan      html  css  js  c++  java
  • vue axios下载接口返回的zip包文件流。

    downAllZip({
            type: this.type,
            page: this.pageNo,
            size: this.pageSize,
            start: this.starttime,
            end: this.endtime,
            t: new Date().getTime()
          }).then((res) => {
            const blob = new Blob([res], { type: 'application/zip' }) // new一个二进制对象
            const url = window.URL.createObjectURL(blob) // 转化为url
            const link = document.createElement('a') // 创建个a标签
            link.href = url
            link.download = '证书包' + (new Date()).getTime()// 重命名
            link.click()
            URL.revokeObjectURL(url)
          }).catch(function(err) {
            console.log(err)
          })
    
    options = {
                  url,
                  method: 'POST',
                  headers: { 'content-type': 'application/x-www-form-urlencoded;charset=UTF-8' },
                  responseType: 'blob',
                  data: qs.stringify(params)
                }
    

      

     

  • 相关阅读:
    c实现二叉树
    C实现栈与队列
    c的链表实现
    LB_Keogh
    LB_Yi
    LB_Kim
    Lab7:同步互斥
    Lab6:进程的调度
    Lab45:进程和线程
    Lab3:虚拟内存管理
  • 原文地址:https://www.cnblogs.com/lml2017/p/14951237.html
Copyright © 2011-2022 走看看