直播app开发搭建,vue使用js-file-download完成导出功能

直播app开发搭建,vue使用js-file-download完成导出功能

1.安装js-file-download

npm install js-file-download

​2.引入对应的功能模块

import fileDownLoad from 'js-file-download'
import Axios from 'axios'//ajax请求
import store from '@/store'//设置token

3.代码段

exportData(){
        var _this = this
        Axios({
          url:'ajax url'
          method: 'post',
          headers: {
           'Authorization': token
          },
          data:{
            licenseNo:_this.searchForm.licenseNo,
          },
          responseType: 'blob',
          }).then(res => {
             fileDownload(res.data, new Date().getTime()+ '.xlsx');
          })
      }

 以上就是 直播app开发搭建,vue使用js-file-download完成导出功能,更多内容欢迎关注之后的文章

 

posted @ 2023-02-10 14:08  云豹科技-苏凌霄  阅读(75)  评论(0)    收藏  举报