Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FR]: Uploader组件选择多个图片同时上传时还是只会上传一张图片 #2549

Open
David19910306 opened this issue Aug 21, 2024 · 6 comments · Fixed by #2660
Open
Assignees

Comments

@David19910306
Copy link

这个功能解决了什么问题?

解决Uploader选择多个图片上传时的问题。目前的问题在Uploader组件中选择多个图片同时上传会导致Onchange事件会触发多次,并且里面的数组参数也都是只有一个元素,而不是多个FileItem元素【上传几张图片就有几个FileItem】。

你期望的组件设计是怎样的?

修改bug

@David19910306
Copy link
Author

David19910306 commented Aug 21, 2024

这个问题,以前的nutui1.5.13的老版本都可以,现在更新到2.x版本翻到不行,也是服了

@Alex-huxiyang
Copy link
Collaborator

升到最新

@David19910306
Copy link
Author

升到最新

现在已经是最新的2.6.17的版本,还是存在同样的问题

@Alex-huxiyang Alex-huxiyang reopened this Sep 3, 2024
@Alex-huxiyang
Copy link
Collaborator

升到最新

现在已经是最新的2.6.17的版本,还是存在同样的问题

收到

@bin2999
Copy link

bin2999 commented Sep 19, 2024

希望尽快修复。。。不能多选,用户体验不太好呀

@zhuddan
Copy link
Contributor

zhuddan commented Dec 2, 2024

我发现选择多个文件最终只会上传最后一个文件的根本原因是 readFile 处理多个文件的时候,由于同步循环操作,导致最后setFileList 只会读取到最后一个文件。现在已经提交 pr#2807修改为使用一个新数组存储多个文件,处理完毕之后,最后在进行setFileList 操作。
详细代码参考,
https://github.com/jdf2e/nutui-react/blob/next/src/packages/uploader/uploader.taro.tsx#L389
https://github.com/jdf2e/nutui-react/blob/next/src/packages/uploader/uploader.tsx#L290

@jdf2e jdf2e deleted a comment from David19910306 Dec 4, 2024
@jdf2e jdf2e deleted a comment from David19910306 Dec 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants