复现已有算法

This commit is contained in:
cloud
2026-07-14 15:43:18 +08:00
parent abebd2a683
commit 50b8111fd9
860 changed files with 182250 additions and 18 deletions
+29
View File
@@ -0,0 +1,29 @@
---
name: frontend-dialog
description: 前端弹窗规范。用于需要确认、提醒、提示输入的交互场景,统一使用 GlobalDialog(或项目统一对话框 Hook),禁止浏览器原生弹窗。
---
# 弹窗规范
## 核心规则
- 禁止使用 `window.alert` / `window.confirm` / `window.prompt`
- 必须使用项目统一弹窗能力(`GlobalDialog` 或统一 `useDialog`
## 使用要求
- 确认型操作使用异步确认 API(返回 `Promise<boolean>`
- 错误提示使用统一 `alert/toast` 能力
- 成功反馈使用统一 `toast`,避免散落样式
## 最小流程
1. 在应用根节点挂载 `DialogProvider`
2. 页面内通过 Hook 调 `confirm/alert/toast`
3. 危险操作必须先 `await confirm(...)` 再执行
## 设计目标
- 统一视觉风格与交互行为
- 避免原生弹窗破坏主题与体验
- 降低重复实现和状态不一致