gpt4 book ai didi

vue中a标签实现带header的下载excel文件

转载 作者:知者 更新时间:2024-03-13 02:40:46 26 4
gpt4 key购买 nike

import Cookie from 'js-cookie'

界面:

<a-button
          slot="extra"
          type="primary"
          @click="exportFile"
          ><a-icon type="download" />导出</a-button>

js方法

exportFile() {
          fetch('http://127.0.0.1:8765/course/exportCourse/33', {
              method: 'GET',
              headers: new Headers({
                  'Authorization': Cookie.get('Authorization') 
              }),
          })
         .then(res => res.blob())
         .then(data => {
              const blobUrl = window.URL.createObjectURL(data);
              const a = document.createElement('a');
              a.download = this.fileName+'.xlsx';
              a.href = blobUrl;
              a.click();
      });
      },

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com