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

Modal.info、Modal.success、Modal.xxx 可以添加关闭接口嘛? #2110

Closed
ystarlongzi opened this issue Jun 20, 2016 · 7 comments · Fixed by #2124
Closed

Modal.info、Modal.success、Modal.xxx 可以添加关闭接口嘛? #2110

ystarlongzi opened this issue Jun 20, 2016 · 7 comments · Fixed by #2124
Assignees

Comments

@ystarlongzi
Copy link
Contributor

在 SPA 应用里考虑这样的一个场景:
在当前页面做了某个操作后,触发了 Modal.info,用来提示一些信息,然后一个不小心点了后退按钮,跳转到另外一页,此时这个 Modal.info 还是存在页面上的,没有被关闭掉。

如果 Modal.info 有返回 close 接口,那么就可以在触发 Modal.info的组件被销毁时,也将Modal.info 也给关闭掉。

另外,看来下源码,如果在/components/modal/confirm.jsx L132前稍微修改,应该就可以满足需求了,如下:

  • 法1)将内部的 close 函数返回
  • 法2)在渲染后的组件实例上,添加 close方法,并且返回改组件实例
@leejaen
Copy link

leejaen commented Jun 21, 2016

同样需要

@afc163
Copy link
Member

afc163 commented Jun 21, 2016

类似 message 和 notification 加上 destory 方法如何。

@RaoHai
Copy link
Contributor

RaoHai commented Jun 21, 2016

Modal.destroy() 一次销毁全部?

还是

var modal = Modal.info({});
modal.destroy();

@afc163
Copy link
Member

afc163 commented Jun 21, 2016

后者好一点。

@ystarlongzi
Copy link
Contributor Author

期待

@RaoHai RaoHai mentioned this issue Jun 21, 2016
@codering
Copy link

这种场景下,组件自身没法自动销毁吗?

@lock
Copy link

lock bot commented May 5, 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 May 5, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants