Smile 笑容

export 'default' (imported as 'XLSX') was not found in 'xlsx' in vuejs

export 'default' (imported as 'XLSX') was not found in 'xlsx' in vuejs

通过对 https://www.npmjs.com/package/xlsx 的文档了解发现 引入代码已经修改,由 import XLSX from xlsx 修改为: import * as XLSX from xlsx

错误详情:
export 'default' (imported as 'XLSX') was not found in 'xlsx' (possible exports: CFB, SSF, parse_xlscfb, parse_zip, read, readFile, readFileSync, set_cptable, set_fs, stream, utils, version, write, writeFile, writeFileAsync, writeFileSync, writeFileXLSX, writeXLSX)

遇到问题先读读文档。遇到问题先读读文档。遇到问题先读读文档。
修改引入代码为:

import * as XLSX from xlsx

问题解决。

这是由具体的插件代码设计形成的。只使用部分功能还可以这样引入:

import { read, writeFileXLSX } from "xlsx";

其他具体可查看文档: https://www.npmjs.com/package/xlsx