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

「demo/pages/FormImageUploadRules」图片上传示例表现行为有问题 #1105

Open
2 of 6 tasks
imsenyu opened this issue Feb 19, 2024 · 2 comments
Open
2 of 6 tasks

Comments

@imsenyu
Copy link
Collaborator

imsenyu commented Feb 19, 2024

组件

基础库版本

  • 1.x
  • 2.x

设备机型

手机系统

  • iOS
  • Android
  • HarmonyOS
  • IDe

APP

支付宝

组件库版本

2.27.1

预期行为

  1. uploadFile 行为是托管给外部上传的,目前示例是 2 秒后 setTimeout 返回数据,但仍然显示「上传失败」

微信

符合预期

image

支付宝

image

@imsenyu
Copy link
Collaborator Author

imsenyu commented Feb 19, 2024

目前最新 master 下,效果变成了,只有最后一张图是好的

image

@imsenyu
Copy link
Collaborator Author

imsenyu commented Feb 19, 2024

先贴下原因

  1. functional-mini 目前的 setState 是一个异步过程
  2. 如果一次性触发 3 个 Promise resolve 的话,在一个 setState 内,第一个 onChange是 done, uploading, uploading ,第二个 onChange 是 uploading, done, uploading (因为 setState 还没完成,第一个 onChange 并没有生效),所以最终会形成只有最后一个 resolve 对应的 item 被更新为 done 其他被还原为上一次 state 时的状态

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant