From 7107c76c25e8831e046e3d3eab24cd837750b15c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E6=9D=A8?= <1711467488@qq.com> Date: Thu, 15 Feb 2018 15:41:18 +0800 Subject: [PATCH] no message Former-commit-id: ab8cdf355d876072816aa4ba63109ae0efe44fcb Former-commit-id: 149582030e374d7a34465012488458bfe0ce46ff Former-commit-id: 49475fb078ac142e903189e6e8d8fff4c0847a96 --- src/plugin/import/index.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/plugin/import/index.js b/src/plugin/import/index.js index 3651f39a..757adf26 100644 --- a/src/plugin/import/index.js +++ b/src/plugin/import/index.js @@ -1,7 +1,7 @@ /* eslint-disable */ // εΊ“ import papa from 'papaparse' -import XLSX from 'xlsx' +import xlsx from 'xlsx' export default { install (Vue, options) { Vue.prototype.$import = { @@ -31,13 +31,13 @@ export default { } const getHeaderRow = sheet => { const headers = [] - const range = XLSX.utils.decode_range(sheet['!ref']) + const range = xlsx.utils.decode_range(sheet['!ref']) let C const R = range.s.r for (C = range.s.c; C <= range.e.c; ++C) { - var cell = sheet[XLSX.utils.encode_cell({ c: C, r: R })] + var cell = sheet[xlsx.utils.encode_cell({ c: C, r: R })] var hdr = 'UNKNOWN ' + C - if (cell && cell.t) hdr = XLSX.utils.format_cell(cell) + if (cell && cell.t) hdr = xlsx.utils.format_cell(cell) headers.push(hdr) } return headers @@ -45,11 +45,11 @@ export default { reader.onload = e => { const data = e.target.result const fixedData = fixdata(data) - const workbook = XLSX.read(btoa(fixedData), { type: 'base64' }) + const workbook = xlsx.read(btoa(fixedData), { type: 'base64' }) const firstSheetName = workbook.SheetNames[0] const worksheet = workbook.Sheets[firstSheetName] const header = getHeaderRow(worksheet) - const results = XLSX.utils.sheet_to_json(worksheet) + const results = xlsx.utils.sheet_to_json(worksheet) resolve({header, results}) } reader.readAsArrayBuffer(file)