FxPopconfirm 气泡确认框
点击触发元素弹出确认气泡,含确认 / 取消按钮。基于 FxPopover。
基础用法
title 设置提示内容,@confirm / @cancel 监听确认 / 取消。
出现位置
placement 控制弹出方向。
自定义按钮
confirm-button-text / cancel-button-text 自定义按钮文字,confirm-button-type / cancel-button-type 自定义类型。
自定义按钮区
actions 插槽可完全替换底部按钮区,作用域提供 { confirm, cancel },调用即触发对应事件并关闭。
局部引入
ts
import { FxPopconfirm } from "@fx/components"API
Attributes
| 名称 | 说明 | 类型 | 默认值 |
|---|---|---|---|
| title | 标题(提示内容) | string | — |
| confirm-button-text | 确认按钮文字 | string | 确定 |
| cancel-button-text | 取消按钮文字 | string | 取消 |
| confirm-button-type | 确认按钮类型 | ButtonType | primary |
| cancel-button-type | 取消按钮类型 | ButtonType | — |
| icon | 自定义图标。字符串为 IconString 类型(即 FxIcon 图标名,如 ep:edit、ant-design:home、svg:xxx) | string | ep:question-filled |
| icon-color | 图标颜色 | string | var(--color-warning) |
| hide-icon | 是否隐藏图标 | boolean | false |
| placement | 出现位置 | Placement | bottom |
| width | 宽度 | string | number | 192 |
| disabled | 是否禁用 | boolean | false |
| show-arrow | 是否显示箭头 | boolean | true |
| teleported / persistent | teleport / 持久化 | boolean | true |
| button-size | 按钮尺寸 | 'small' | 'default' | 'large' | — |
| hide-after | 隐藏延时(ms) | number | 200 |
| visible (v-model:visible) ^(fx 增强) | 是否显示 | boolean | — |
| virtual-triggering | 是否启用虚拟触发 | boolean | false |
| virtual-ref | 虚拟触发元素,配合 virtual-triggering | Measurable | — |
Slots
| 名称 | 说明 |
|---|---|
| reference | 触发元素 |
| actions | 自定义底部按钮区,作用域 { confirm, cancel } |
Events
| 名称 | 说明 |
|---|---|
| confirm | 点击确认(参数 MouseEvent) |
| cancel | 点击取消(参数 MouseEvent) |
| update:visible ^(fx 增强) | 显隐变化 |
实现说明
- 浮层引擎基于
@floating-ui/dom v-model:visible、disabled/placement/offset/show-arrow/show-after/popper-class/popper-style/button-size为 fx 扩展能力- 图标走
@fx-core/icon,样式走@fx/stylestoken
