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

upload的onRemove这个钩子应该怎么使用,为什么我写东西会覆盖掉原有的事件? #3317

Closed
ouzhou opened this issue Oct 7, 2016 · 8 comments
Assignees
Labels
🐛 Bug Ant Design Team had proved that this is a bug.

Comments

@ouzhou
Copy link

ouzhou commented Oct 7, 2016

如题 onRemove={()=>{//do something}} 会把原有的事件覆盖掉 那如何既保持原有的事件又运行一些我自己的逻辑呢?

还有一个小问题
image
我想关闭弹窗同时把upload的预览图也关掉,能不能做到?

@benjycui
Copy link
Contributor

benjycui commented Oct 8, 2016

看不懂。。。不要假设我们对你们的业务场景有所了解。

提供的信息越详细越好。

@ouzhou
Copy link
Author

ouzhou commented Oct 8, 2016

是这样的 Upload的文档里面只是说了onRemove这个是一个钩子,我以为是点击预览那个叉叉,就会去调用onRemove里面的逻辑,(确实是这样的)但是我发现我写的逻辑会把原生的取消预览的功能覆盖掉了,那这个onRemove好像就没有什么作用了啊。 还有 如何去trigger 触发onRemove事件呢?

@benjycui
Copy link
Contributor

benjycui commented Oct 8, 2016

d584b20

@joesonw 这样设计的原因是?

@joesonw
Copy link
Contributor

joesonw commented Oct 8, 2016

@benjycui 当初添加这个的时候, 想的是可以让使用者决定点击之后发生什么事情, 例如弹出PopConfirm, 确认后, 改变fileList的state达到删除的目的.
@ouzhou 原生的取消预览, 是指移除文件吗?

@afc163
Copy link
Member

afc163 commented Oct 8, 2016

现在的确实有问题。应该是指定了 fileList 时(受控),才不去调用默认的 remove 逻辑。

@afc163 afc163 added the 🐛 Bug Ant Design Team had proved that this is a bug. label Oct 8, 2016
@ouzhou
Copy link
Author

ouzhou commented Oct 8, 2016

@joesonw 是的, 移除文件,
而且我感觉 upload 这个组件跟表单校验的配合不太好,我的实现方式是写了一个隐藏的input,把upload的校验放到校验这个input是否传入值
希望提供一个trigger 触发移除文件事件

@wangyazhen
Copy link

@joesonw 点击删除的时候 弹出PopConfirm 这个应该怎么来实现
我想要这样的效果-- >

upload-pop

没有研究出来以上效果, 目前采用Modal.confirm的方式 -_-

@lock
Copy link

lock bot commented Jun 15, 2018

This thread has been automatically locked because it has not had recent activity. Please open a new issue for related bugs and link to relevant comments in this thread.

@lock lock bot locked as resolved and limited conversation to collaborators Jun 15, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
🐛 Bug Ant Design Team had proved that this is a bug.
Projects
None yet
Development

No branches or pull requests

5 participants