文件的导出excel

205 阅读1分钟
// import XLSX from 'xlsx'
// import FileSaver from 'file-saver'
// var xlsxParam = { raw: true }
      // var wb
      // var fix = document.querySelector('.el-table__fixed-right')
      // if (fix) {
      //   wb = XLSX.utils.table_to_book(document.querySelector('#my-table').removeChild(fix), xlsxParam)
      //   document.querySelector('#my-table').appendChild(fix)
      // } else {
      //   wb = XLSX.utils.table_to_book(document.querySelector('#my-table'), xlsxParam)
      // }
      // var wbout = XLSX.write(wb, {
      //   bookType: 'xlsx',
      //   bookSST: true,
      //   type: 'array'
      // })
      // try {
      //   FileSaver.saveAs(
      //     //Blob 对象表示一个不可变、原始数据的类文件对象。
      //     //Blob 表示的不一定是JavaScript原生格式的数据。
      //     //File 接口基于Blob,继承了 blob 的功能并将其扩展使其支持用户系统上的文件。
      //     //返回一个新创建的 Blob 对象,其内容由参数中给定的数组串联组成。
      //     new Blob([wbout], { type: 'application/octet-stream' }),
      //     //设置导出文件名称
      //     '上报统计.xlsx'
      //   )
      // } catch (e) {
      //   if (typeof console !== 'undefined') console.log(e, wbout)
      // }
      // return wbout