let params = {
        compStartTm: Date.parse(this.searchForm.compStartTm) / 1000,
        compEndTm: Date.parse(this.searchForm.compEndTm) / 1000 + 86400,
        collectWay: this.searchForm.collectWay,
      };
      this.loading = true;
      var _this = this;
      this.$httpExt().post("/xxxx/xxxxxx", params, { responseType: 'arraybuffer' }).then(res => {
        if (res) {
          _this.loading = false;
          const aLink = document.createElement("a");
          let blob = new Blob([res.data], {type: "application/vnd.ms-excel"})
          aLink.href = URL.createObjectURL(blob)
          aLink.setAttribute('download', '哈哈哈哈' + '.xlsx') // 设置下载文件名称
          aLink.click()
          this.$refs.loadElement.appendChild(aLink)
        }
      },res => {
        _this.$message.error(res.msg);
        _this.loading = false;
      });

 参考地址:https://segmentfault.com/a/1190000020540788 

相关文章:

  • 2021-04-25
  • 2022-12-23
  • 2021-08-12
  • 2021-12-23
  • 2022-01-10
  • 2022-12-23
  • 2022-01-08
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-09-25
  • 2022-02-06
  • 2022-12-23
相关资源
相似解决方案