上传excel文件后修改表格内容报错The requested file could not be read, typically due to permission problems that ha

报错:

上传excel文件后修改表格内容报错 The requested file could not be read, typically due to permission problems that have occurred after a reference to a file was acquired.

上传excel文件后修改表格内容报错The requested file could not be read, typically due to permission problems that ha_第1张图片

代码如下

antd form中自定义上传图片
上传excel文件后修改表格内容报错The requested file could not be read, typically due to permission problems that ha_第2张图片

报错原因

从打印结果来看 报错原因是因为返回的Promise状态为pending
上传excel文件后修改表格内容报错The requested file could not be read, typically due to permission problems that ha_第3张图片

自定义校验函数, 可以看到图中都有返回对应的Promise状态
上传excel文件后修改表格内容报错The requested file could not be read, typically due to permission problems that ha_第4张图片

解决

看了半天才发现忽略了181行的 await workbook.xlsx.load(file);的异步操作解析错误,造成这种情况是因为已经上传了文件,又修改了本地excel中的数据ÿ

你可能感兴趣的:(excel,前端,reactjs)