bricks/docs/ai/conform.md
2025-11-18 16:01:43 +08:00

27 lines
1.3 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Conform
控件功能:用于显示一个确认对话框,包含消息内容和“确认”与“取消”操作按钮,常用于用户操作前的二次确认。
类型:容器控件
父类控件:`bricks.PopupWindow`
## 初始化参数
| 参数名 | 类型 | 说明 |
|--------|------|------|
| `message` | String | 要显示的消息文本内容支持多语言i18n和自动换行。 |
| `conform` | Object | 可选,用于自定义“确认”按钮的配置,如事件处理扩展、图标、标签等,会合并到默认配置中。 |
| `discard` | Object | 可选,用于自定义“取消”按钮的配置,行为同 `conform`。 |
| `timeout` | Number | 继承自父类,此处被强制设为 0表示不启用自动关闭。 |
| `auto_open` | Boolean | 继承自父类,设为 true表示构造后自动弹出显示。 |
> 注:`opts` 中其他继承自 `PopupWindow` 的参数也适用,但本控件内部重写了 `timeout` 和 `auto_open`。
## 主要事件
| 事件名 | 触发时机 | 携带数据 |
|--------|----------|--------|
| `conformed` | 用户点击“确认”按钮时触发 | 无特定数据,仅事件通知 |
| `cancelled` | 用户点击“取消”按钮时触发 | 无特定数据,仅事件通知 |
> 事件通过 `this.dispatch()` 派发,可通过实例绑定监听。