Ant-design-mobile: `Modal.alert` 能否暴露个 `className` 参数

Created on 17 Sep 2018  ·  11Comments  ·  Source: ant-design/ant-design-mobile

有时候需要使用 Modal.alert 进行信息提示,且样式、大小等于预置的样式并不一样。

可否在传参中暴露一个 className 参数进去,用于用户自定义修改 alert 里边的 Modal

Most helpful comment

其实,最后 Modal.alertModal.promptModal.operation 都可能会用到 className 属性。

All 11 comments

Translation of this issue:


Modal.alert Can you expose a className parameter?

Sometimes you need to use Modal.alert for information prompts, and the style and size are different from the preset styles.

Can you expose a className parameter in the parameter, for user-defined modification alert inside Modal

This proposal is very good!

赶紧的啊,暴露一个 classname 接口!

其实,最后 Modal.alertModal.promptModal.operation 都可能会用到 className 属性。

为啥不暴露一个对象用于和直接使用Modal方式类似的参数呢,搞不懂

这三种对话框还存在一个问题:页面已卸载,但对话框依旧存在

这三种对话框还存在一个问题:页面已卸载,但对话框依旧存在

对话框的挂载点不在当前页面的上,而是再外部的节点。所以当前页面卸载了,对话框还在属正常。

@GHLandy 请问这个问题怎么解决的呢?

好吧,暂时用在外层套一个 wrapper div ,然后给这个 wrapper div 一个自定义的 className 来解决这个问题。

@GHLandy 请问这个问题怎么解决的呢?

Modal.alert(
  <div className="title">标题</div>, 
  <div className="content">提示内容</div>,
)

我是 在alert打开以后,用js添加className解决该问题的

Was this page helpful?
0 / 5 - 0 ratings