Skip to content

是否可以考虑为Modal组件增加关闭弹窗前的回调函数 #5538

@geeklibin

Description

@geeklibin
  • I have searched the issues of this repository and believe that this is not a duplicate.

What problem does this feature solve?

modal对话框的关闭前确认。

What does the proposed API look like?

<!--template-->
<a-modal :beforeClose="beforeClose">
</a-modal>
//javascript
//返回布尔值的方式
const beforeClose = () => {
    return false;//返回true时允许关闭,返回false取消关闭。
}
//或可以支持promise
const beforeClose = () => new Promise((resolve, reject) => {
    let cfm = confirm('内容尚未保存,关闭弹窗将丢失数据,确定关闭吗?')
    if(cfm) return resolve()
    return reject()
})

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions