mirror of
https://gitee.com/qqtt-ah/ai-crm.git
synced 2026-11-24 03:09:19 +08:00
131 lines
4.6 KiB
Markdown
131 lines
4.6 KiB
Markdown
# Agent 前端 UI 组件清单(Vben 5.7 / web-antd)
|
||
|
||
写 `apps/web/apps/web-antd` 时按:**Vben → Ant Design Vue → 可复用就封装 → 最后自研**。
|
||
|
||
业务页是 **Ant Design 皮肤**:原子控件用 antd,不要用 shadcn 系 `VbenButton` 等(偏框架内部)。
|
||
|
||
---
|
||
|
||
## 1. 选用顺序
|
||
|
||
| 顺序 | 用什么 | 何时 |
|
||
|------|--------|------|
|
||
| ① | Vben 应用层(下表) | 页面壳、弹窗抽屉、表单、表格、远程下拉 |
|
||
| ② | `ant-design-vue` | 按钮/输入/标签/反馈等原子控件 |
|
||
| ③ | 项目内封装 | 多处重复(放 `components/` 或补 adapter) |
|
||
| ④ | 自研 | 仅 ①②③ 都不够,并注明原因 |
|
||
|
||
典型列表页:`Page` + `useVbenVxeGrid` +(可选搜索 `useVbenForm`)+ `useVbenModal`。
|
||
|
||
---
|
||
|
||
## 2. Vben 可用组件(简表)
|
||
|
||
### 布局 / 页面
|
||
|
||
| 导出 | 用途 |
|
||
|------|------|
|
||
| `Page` | 标准内容页壳(标题区 + 内容区) |
|
||
| `ColPage` | 左右可拖拽分栏(侧栏 + 主区) |
|
||
| `Fallback` | 403/404/500/离线等兜底 |
|
||
|
||
来自 `@vben/common-ui`。
|
||
|
||
### 弹层 / 反馈
|
||
|
||
| 导出 | 用途 |
|
||
|------|------|
|
||
| `useVbenModal` / `VbenModal` | 业务弹窗(优先于 antd Modal) |
|
||
| `useVbenDrawer` / `VbenDrawer` | 业务抽屉 |
|
||
| `alert` / `confirm` / `prompt` | 命令式确认、提示、输入 |
|
||
|
||
来自 `@vben/common-ui`(popup-ui)。
|
||
|
||
### 表单
|
||
|
||
| 导出 | 用途 |
|
||
|------|------|
|
||
| `useVbenForm` | 配置式表单(搜索栏 / 弹窗表单) |
|
||
| `z` | Zod 校验 |
|
||
| `ApiComponent` | 远程数据驱动的选择器底座 |
|
||
|
||
业务代码用 `#/adapter/form` 的 `useVbenForm`(已接 antd 组件)。
|
||
|
||
**表单 schema `component` 已注册类型:**
|
||
|
||
`Input` `InputNumber` `InputPassword` `Textarea` `Mentions` `Select` `ApiSelect` `TreeSelect` `ApiTreeSelect` `AutoComplete` `Checkbox` `CheckboxGroup` `Radio` `RadioGroup` `Switch` `DatePicker` `RangePicker` `TimePicker` `Rate` `Upload` `Divider` `Space` `IconPicker` `DefaultButton` `PrimaryButton`
|
||
|
||
### 表格
|
||
|
||
| 导出 | 用途 |
|
||
|------|------|
|
||
| `useVbenVxeGrid` / `VbenVxeGrid` | 列表/工具栏/分页(优先于手写 antd Table) |
|
||
|
||
来自 `#/adapter/vxe-table`(底层 `@vben/plugins/vxe-table`)。
|
||
|
||
### 其它 common-ui
|
||
|
||
| 导出 | 用途 |
|
||
|------|------|
|
||
| `EllipsisText` | 超长省略 + tooltip |
|
||
| `CountTo` | 数字滚动动画 |
|
||
| `JsonViewer` | JSON 树查看 |
|
||
| `IconPicker` | 图标选择 |
|
||
| `Loading` / `Spinner` | 加载指示 |
|
||
| `Tree` | 树(Vben 版) |
|
||
| `VCropper` | 图片裁剪 |
|
||
| `VResize` | 拖拽调宽 |
|
||
| `Tippy` | Tippy 浮层 |
|
||
| `SliderCaptcha` / `SliderRotateCaptcha` / `SliderTranslateCaptcha` / `PointSelectionCaptcha` | 验证码 |
|
||
|
||
### 插件 `@vben/plugins`
|
||
|
||
| 导出 | 用途 |
|
||
|------|------|
|
||
| `EchartsUI` / `useEcharts` | 图表 |
|
||
| `VbenTiptap` / `VbenTiptapPreview` | 富文本 |
|
||
| `useVbenVxeGrid` | 见上(经 adapter) |
|
||
|
||
### 认证 / 工作台 UI(少改业务页)
|
||
|
||
`AuthenticationLogin` `AuthenticationRegister` `AuthenticationCodeLogin` `AuthenticationQrCodeLogin` `AuthenticationForgetPassword` `AuthenticationLoginExpiredModal`;`Workbench*` / `Analysis*`;`Profile*`;`About`。
|
||
|
||
### shadcn 封装(一般不直接用于业务页)
|
||
|
||
`VbenAvatar` `VbenButton` `VbenButtonGroup` `VbenCheckbox` `VbenCheckButtonGroup` `VbenCollapsibleParams` `VbenContextMenu` `VbenCountToAnimator` `VbenFullScreen` `VbenIconButton` `VbenInputPassword` `VbenLoading` `VbenLogo` `VbenPinInput` `VbenSelect` `VbenSpinner` 等——框架/布局内部用;**业务交互控件继续用 antd**。
|
||
|
||
---
|
||
|
||
## 3. Ant Design Vue(②)
|
||
|
||
Vben 没有对等封装时用 antd,例如:
|
||
|
||
- 操作:`Button` `Dropdown` `Popconfirm`
|
||
- 输入:`Input` `InputNumber` `Select` `Cascader` `TreeSelect` `DatePicker` `Upload` …
|
||
- 展示:`Tag` `Card` `Descriptions` `Empty` `Image` `Badge` `Avatar` `Statistic` `Progress` `Skeleton` `Alert` `Result`
|
||
- 布局:`Space` `Flex` `Row` `Col` `Divider` `Tabs`
|
||
- 反馈:`message` `notification` `Modal`(极简临时) `Spin`(注意滚动规则)
|
||
- 轻量表:少量静态数据可用 antd `Table`;正式列表仍用 `useVbenVxeGrid`
|
||
|
||
图标:`@ant-design/icons-vue`。
|
||
|
||
---
|
||
|
||
## 4. 导入示例
|
||
|
||
```ts
|
||
import { Page, useVbenModal } from '@vben/common-ui';
|
||
import { useVbenForm, z } from '#/adapter/form';
|
||
import { useVbenVxeGrid } from '#/adapter/vxe-table';
|
||
import { Button, Space, message } from 'ant-design-vue';
|
||
```
|
||
|
||
---
|
||
|
||
## 5. 源码位置(需查 props 时)
|
||
|
||
- `@vben/common-ui` → `packages/effects/common-ui`
|
||
- Form / Modal / Drawer → `packages/@core/ui-kit/form-ui`、`popup-ui`
|
||
- VXE / ECharts / Tiptap → `packages/effects/plugins`
|
||
- antd 表单适配 → `apps/web-antd/src/adapter/`
|