From e4f2b1e587f562b281aef5d611f8cb63a659fe5e Mon Sep 17 00:00:00 2001 From: Serge Date: Mon, 30 Sep 2019 13:14:55 +0800 Subject: [PATCH] perf: optimize import file-saver way(#2347) --- src/vendor/Export2Excel.js | 6 +++--- src/vendor/Export2Zip.js | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/vendor/Export2Excel.js b/src/vendor/Export2Excel.js index 20784f3a..d8a2af3d 100644 --- a/src/vendor/Export2Excel.js +++ b/src/vendor/Export2Excel.js @@ -1,5 +1,5 @@ /* eslint-disable */ -require('script-loader!file-saver'); +import { saveAs } from 'file-saver' import XLSX from 'xlsx' function generateArray(table) { @@ -151,14 +151,14 @@ export function export_json_to_excel({ filename, merges = [], autoWidth = true, - bookType= 'xlsx' + bookType = 'xlsx' } = {}) { /* original data */ filename = filename || 'excel-list' data = [...data] data.unshift(header); - for (let i = multiHeader.length-1; i > -1; i--) { + for (let i = multiHeader.length - 1; i > -1; i--) { data.unshift(multiHeader[i]) } diff --git a/src/vendor/Export2Zip.js b/src/vendor/Export2Zip.js index f776465e..db70707d 100644 --- a/src/vendor/Export2Zip.js +++ b/src/vendor/Export2Zip.js @@ -1,5 +1,5 @@ /* eslint-disable */ -require('script-loader!file-saver'); +import { saveAs } from 'file-saver' import JSZip from 'jszip' export function export_txt_to_zip(th, jsonData, txtName, zipName) {