mirror of
https://github.com/cool-team-official/cool-admin-vue.git
synced 2024-11-01 14:10:27 +08:00
优化
This commit is contained in:
parent
a83f2029e9
commit
9f37d489e9
@ -139,14 +139,14 @@ function onUpload(raw: File, _: any, { next }: any) {
|
||||
let data = "";
|
||||
|
||||
if (ext == "csv") {
|
||||
const detected = chardet.detect(new Uint8Array(event.target.result));
|
||||
const detected: any = chardet.detect(new Uint8Array(event.target.result));
|
||||
const decoder = new TextDecoder(detected);
|
||||
data = decoder.decode(event.target.result);
|
||||
} else {
|
||||
data = event.target.result;
|
||||
}
|
||||
|
||||
const workbook = XLSX.read(data, { type: "binary" });
|
||||
const workbook = XLSX.read(data, { type: "binary", raw: ext == "csv" });
|
||||
|
||||
let json: any[] = [];
|
||||
for (const sheet in workbook.Sheets) {
|
||||
|
Loading…
Reference in New Issue
Block a user