2016-03-31 14:17:09 +08:00
|
|
|
---
|
|
|
|
category: Components
|
2016-09-21 11:28:38 +08:00
|
|
|
subtitle: 气泡确认框
|
2022-11-09 12:28:04 +08:00
|
|
|
group: 反馈
|
2016-09-21 11:28:38 +08:00
|
|
|
title: Popconfirm
|
2022-11-30 20:14:41 +08:00
|
|
|
cover: https://mdn.alipayobjects.com/huamei_7uahnr/afts/img/A*sAGpRoBtTXcAAAAAAAAAAAAADrJ8AQ/original
|
2023-02-09 22:17:31 +08:00
|
|
|
coverDark: https://mdn.alipayobjects.com/huamei_7uahnr/afts/img/A*HrFtQ6jJJFQAAAAAAAAAAAAADrJ8AQ/original
|
2022-11-09 12:28:04 +08:00
|
|
|
demo:
|
|
|
|
cols: 2
|
2016-03-31 14:17:09 +08:00
|
|
|
---
|
2015-06-15 22:01:39 +08:00
|
|
|
|
2015-06-24 19:20:47 +08:00
|
|
|
点击元素,弹出气泡式的确认框。
|
2015-06-17 20:24:42 +08:00
|
|
|
|
2015-06-24 19:20:47 +08:00
|
|
|
## 何时使用
|
2015-06-17 20:24:42 +08:00
|
|
|
|
2015-06-24 19:20:47 +08:00
|
|
|
目标元素的操作需要用户进一步的确认时,在目标元素附近弹出浮层提示,询问用户。
|
2015-06-17 20:24:42 +08:00
|
|
|
|
2015-06-24 19:20:47 +08:00
|
|
|
和 `confirm` 弹出的全屏居中模态对话框相比,交互形式更轻量。
|
2015-06-17 20:24:42 +08:00
|
|
|
|
2022-11-09 12:28:04 +08:00
|
|
|
## 代码演示
|
|
|
|
|
2022-11-17 17:31:26 +08:00
|
|
|
<!-- prettier-ignore -->
|
2022-11-09 12:28:04 +08:00
|
|
|
<code src="./demo/basic.tsx">基本</code>
|
|
|
|
<code src="./demo/locale.tsx">国际化</code>
|
|
|
|
<code src="./demo/placement.tsx">位置</code>
|
|
|
|
<code src="./demo/dynamic-trigger.tsx">条件触发</code>
|
|
|
|
<code src="./demo/icon.tsx">自定义 Icon 图标</code>
|
|
|
|
<code src="./demo/async.tsx">异步关闭</code>
|
|
|
|
<code src="./demo/promise.tsx">基于 Promise 的异步关闭</code>
|
|
|
|
<code src="./demo/render-panel.tsx" debug>_InternalPanelDoNotUseOrYouWillBeFired</code>
|
2022-12-06 23:14:30 +08:00
|
|
|
<code src="./demo/wireframe.tsx" debug>线框风格</code>
|
2022-11-09 12:28:04 +08:00
|
|
|
|
2015-06-24 19:20:47 +08:00
|
|
|
## API
|
2015-06-17 20:24:42 +08:00
|
|
|
|
2021-10-29 08:50:01 +08:00
|
|
|
| 参数 | 说明 | 类型 | 默认值 | 版本 |
|
|
|
|
| --- | --- | --- | --- | --- |
|
2022-12-22 14:12:26 +08:00
|
|
|
| cancelButtonProps | cancel 按钮 props | [ButtonProps](/components/button-cn#api) | - | |
|
2021-10-29 08:50:01 +08:00
|
|
|
| cancelText | 取消按钮文字 | string | `取消` | |
|
|
|
|
| disabled | 阻止点击 Popconfirm 子元素时弹出确认框 | boolean | false | |
|
|
|
|
| icon | 自定义弹出气泡 Icon 图标 | ReactNode | <ExclamationCircle /> | |
|
2022-12-22 14:12:26 +08:00
|
|
|
| okButtonProps | ok 按钮 props | [ButtonProps](/components/button-cn#api) | - | |
|
2021-10-29 08:50:01 +08:00
|
|
|
| okText | 确认按钮文字 | string | `确定` | |
|
|
|
|
| okType | 确认按钮类型 | string | `primary` | |
|
2021-12-28 13:29:43 +08:00
|
|
|
| showCancel | 是否显示取消按钮 | boolean | true | 4.18.0 |
|
2022-12-08 16:39:42 +08:00
|
|
|
| title | 确认框标题 | ReactNode \| () => ReactNode | - | |
|
|
|
|
| description | 确认内容的详细描述 | ReactNode \| () => ReactNode | - | 5.1.0 |
|
2021-10-29 08:50:01 +08:00
|
|
|
| onCancel | 点击取消的回调 | function(e) | - | |
|
|
|
|
| onConfirm | 点击确认的回调 | function(e) | - | |
|
2023-05-11 15:44:55 +08:00
|
|
|
| onPopupClick | 弹出气泡点击事件 | function(e) | - | 5.5.0 |
|
2016-12-22 12:00:57 +08:00
|
|
|
|
2022-12-22 14:12:26 +08:00
|
|
|
更多属性请参考 [Tooltip](/components/tooltip-cn/#api)。
|
2017-01-22 14:26:46 +08:00
|
|
|
|
2023-04-11 10:25:24 +08:00
|
|
|
## Design Token
|
|
|
|
|
|
|
|
<ComponentTokenTable component="Popconfirm"></ComponentTokenTable>
|
|
|
|
|
2017-01-22 14:26:46 +08:00
|
|
|
## 注意
|
|
|
|
|
2017-01-22 15:05:32 +08:00
|
|
|
请确保 `Popconfirm` 的子元素能接受 `onMouseEnter`、`onMouseLeave`、`onFocus`、`onClick` 事件。
|