2016-03-31 09:40:55 +08:00
|
|
|
---
|
|
|
|
order: 0
|
2016-08-26 14:42:41 +08:00
|
|
|
title:
|
|
|
|
zh-CN: 基本
|
|
|
|
en-US: Basic
|
2016-03-31 09:40:55 +08:00
|
|
|
---
|
2015-06-24 19:20:47 +08:00
|
|
|
|
2016-08-26 14:42:41 +08:00
|
|
|
## zh-CN
|
|
|
|
|
2015-06-24 19:20:47 +08:00
|
|
|
最简单的用法。
|
|
|
|
|
2016-08-26 14:42:41 +08:00
|
|
|
## en-US
|
|
|
|
|
|
|
|
The basic example.
|
|
|
|
|
2022-05-19 09:46:26 +08:00
|
|
|
```tsx
|
2022-05-21 22:14:15 +08:00
|
|
|
import { message, Popconfirm } from 'antd';
|
2022-05-19 09:46:26 +08:00
|
|
|
import React from 'react';
|
2015-06-24 19:20:47 +08:00
|
|
|
|
2022-05-19 09:46:26 +08:00
|
|
|
const confirm = (e: React.MouseEvent<HTMLElement>) => {
|
2017-02-24 16:07:39 +08:00
|
|
|
console.log(e);
|
2016-09-29 11:27:59 +08:00
|
|
|
message.success('Click on Yes');
|
2022-05-19 09:46:26 +08:00
|
|
|
};
|
2015-07-17 00:25:03 +08:00
|
|
|
|
2022-05-19 09:46:26 +08:00
|
|
|
const cancel = (e: React.MouseEvent<HTMLElement>) => {
|
2017-02-24 16:07:39 +08:00
|
|
|
console.log(e);
|
2016-09-29 11:27:59 +08:00
|
|
|
message.error('Click on No');
|
2022-05-19 09:46:26 +08:00
|
|
|
};
|
2015-06-24 19:20:47 +08:00
|
|
|
|
2022-05-19 09:46:26 +08:00
|
|
|
const App: React.FC = () => (
|
2019-05-07 14:57:32 +08:00
|
|
|
<Popconfirm
|
2020-11-16 09:27:02 +08:00
|
|
|
title="Are you sure to delete this task?"
|
2019-05-07 14:57:32 +08:00
|
|
|
onConfirm={confirm}
|
|
|
|
onCancel={cancel}
|
|
|
|
okText="Yes"
|
|
|
|
cancelText="No"
|
|
|
|
>
|
2016-09-29 11:27:59 +08:00
|
|
|
<a href="#">Delete</a>
|
2022-04-03 23:27:45 +08:00
|
|
|
</Popconfirm>
|
2018-11-28 15:00:03 +08:00
|
|
|
);
|
2022-05-19 09:46:26 +08:00
|
|
|
|
|
|
|
export default App;
|
2019-05-07 14:57:32 +08:00
|
|
|
```
|