this.axios({
          method: "post",
          url: '/jishi/jishi.daochu',
          responseType: 'blob',
          data: data //需要传的字段
        }).then((res) => {
          let blob = new Blob([res.data], {
            type: `application/pdf` //word文档为msword,pdf文档为pdf
          });
          let objectUrl = URL.createObjectURL(blob);
          let link = document.createElement("a");
          let fname = `pdf`; //下载文件的名字
          link.href = objectUrl;
          link.setAttribute("download", fname);
          document.body.appendChild(link);
          link.click();
        })

 

Logo

前往低代码交流专区

更多推荐