Back to Ant Design

Popconfirm

components/popconfirm/index.zh-CN.md

6.3.72.4 KB
Original Source

何时使用 {#when-to-use}

目标元素的操作需要用户进一步的确认时,在目标元素附近弹出浮层提示,询问用户。

confirm 弹出的全屏居中模态对话框相比,交互形式更轻量。

代码演示 {#examples}

<!-- prettier-ignore -->

<code src="./demo/basic.tsx">基本</code> <code src="./demo/locale.tsx">国际化</code> <code src="./demo/placement.tsx">位置</code> <code src="./demo/shift.tsx" iframe="300">贴边偏移</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/style-class.tsx" version="6.0.0">自定义语义结构的样式和类</code> <code src="./demo/render-panel.tsx" debug>_InternalPanelDoNotUseOrYouWillBeFired</code> <code src="./demo/wireframe.tsx" debug>线框风格</code>

API

通用属性参考:通用属性

参数说明类型默认值版本
cancelButtonPropscancel 按钮 propsButtonProps-
cancelText取消按钮文字string取消
disabled阻止点击 Popconfirm 子元素时弹出确认框booleanfalse
icon自定义弹出气泡 Icon 图标ReactNode<ExclamationCircle />
okButtonPropsok 按钮 propsButtonProps-
okText确认按钮文字string确定
okType确认按钮类型stringprimary
showCancel是否显示取消按钮booleantrue4.18.0
title确认框标题ReactNode | () => ReactNode-
description确认内容的详细描述ReactNode | () => ReactNode-5.1.0
onCancel点击取消的回调function(e)-
onConfirm点击确认的回调function(e)-
onPopupClick弹出气泡点击事件function(e)-5.5.0
<!-- 共同的 API -->

<embed src="../tooltip/shared/sharedProps.zh-CN.md"></embed>

Semantic DOM

<code src="./demo/_semantic.tsx" simplify="true"></code>

主题变量(Design Token){#design-token}

<ComponentTokenTable component="Popconfirm"></ComponentTokenTable>

FAQ

<embed src="../tooltip/shared/sharedFAQ.zh-CN.md"></embed>

更多问题,请参考 Tooltip FAQ