mirror of
https://github.com/ant-design/ant-design.git
synced 2024-11-29 05:29:37 +08:00
37 lines
611 B
Markdown
37 lines
611 B
Markdown
---
|
|
order: 3
|
|
title:
|
|
zh-CN: 确认对话框
|
|
en-US: Confirmation modal dialog
|
|
---
|
|
|
|
## zh-CN
|
|
|
|
使用 `confirm()` 可以快捷地弹出确认框。
|
|
|
|
## en-US
|
|
|
|
To use `confirm()` to popup a confirmation modal dialog.
|
|
|
|
````jsx
|
|
import { Modal, Button } from 'antd';
|
|
const confirm = Modal.confirm;
|
|
|
|
function showConfirm() {
|
|
confirm({
|
|
title: 'Are you sure you want to delete these items ?',
|
|
content: 'some descriptions',
|
|
onOk() {
|
|
console.log('OK');
|
|
},
|
|
onCancel() {},
|
|
});
|
|
}
|
|
|
|
ReactDOM.render(
|
|
<Button onClick={showConfirm}>
|
|
confirmation modal dialog
|
|
</Button>
|
|
, mountNode);
|
|
````
|