• vuede axios文件下载


    this.loading = true;
    this.$http({
    baseURL: CLOUD_BASE_SERVER_URL,
              url: '/audit/auditRun/exportWord',
              method: 'get',
              responseType: 'blob',
              params: {
    id: this.runId,
    sumScoreRate: this.sumScoreRate
              }
            }).then(response => {
              this.loading = false
              var data = response.data;
      
              if (!data) {
                return
              }
      
              let url = window.URL.createObjectURL(new Blob([data]))
              let link = document.createElement('a');
              link.style.display = 'none';
              link.href = url;
              //设置新下载的文件名
              var downLoadFileName = '危险源登记.docx';
              link.setAttribute('download', downLoadFileName);
      
              document.body.appendChild(link);
              link.click();
            }).catch((error) => {
              console.log(error);
            });
  • 相关阅读:
    web高级第一节
    Socket网络编程
    redis第三节
    redis第二节
    Git(2)
    Xamarin.Android 应用程序配置
    Android--ListView与数据绑定(Xamarin)
    Android--Activity(活动)
    Xamarin Android 真机调试时闪退
    wpf 将Style应用到 ListView 中的 ListViewItem 元素
  • 原文地址:https://www.cnblogs.com/zengdingxin/p/11268448.html
Copyright © 2020-2023  润新知