You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

60 lines
1012 B

---
order: 3
8 years ago
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: 'Do you Want to delete these items?',
content: 'Some descriptions',
onOk() {
console.log('OK');
},
onCancel() {
console.log('Cancel');
},
});
}
function showDeleteConfirm() {
confirm({
title: 'Are you sure delete this task?',
content: 'Some descriptions',
okText: 'Yes',
okType: 'danger',
cancelText: 'No',
onOk() {
console.log('OK');
},
onCancel() {
console.log('Cancel');
},
});
}
9 years ago
ReactDOM.render(
<div>
<Button onClick={showConfirm}>
Confirm
</Button>
<Button onClick={showDeleteConfirm} type="dashed">
Delete
</Button>
</div>
, mountNode);
````