root 1 年之前
父节点
当前提交
00967e56ca
共有 2 个文件被更改,包括 3 次插入3 次删除
  1. 2 2
      js/excel.js
  2. 1 1
      test.html

+ 2 - 2
js/excel.js

@@ -1,9 +1,9 @@
 
 
-exceltoxlxstream = function (file) {
+exceltoxlxstream = async function (file) {
     if (file) {
         const reader = new FileReader();
-        reader.onload = function (e) {
+        reader.onload = async function (e) {
             const data = new Uint8Array(e.target.result);
             const workbook = XLSX.read(data, { type: 'array' });
             const fileStream = XLSX.write(workbook, { type: 'array', bookType: 'xlsx' });

+ 1 - 1
test.html

@@ -6,7 +6,7 @@
     <script src="./js/excel.js" type="text/javascript"></script>
     <script>
         function test(inputel) {
-            console.log(exceltoxlxstream(inputel.files[0]));
+            console.log(await exceltoxlxstream(inputel.files[0]));
         }