签入版本
This commit is contained in:
@@ -1,105 +1,58 @@
|
||||
# G. 前端组件速查
|
||||
# H. 前端组件速查
|
||||
|
||||
:::tip 概述
|
||||
以下组件定义在 `ui/src/components/` 目录下,可在页面中直接引入使用。
|
||||
:::tip 说明
|
||||
`ui/src/components` 公共组件速查(28 个)。业务页面优先复用;页面私有组件放 views 下 components/。
|
||||
:::
|
||||
|
||||
## 数据展示
|
||||
## 骨架与容器
|
||||
|
||||
| 组件 | 路径 | 说明 | 核心 Props |
|
||||
|------|------|------|-----------|
|
||||
| BasicTable | `components/Table/` | 数据表格 | `columns`、`dataSource`、`pagination` |
|
||||
| PageWrapper | `components/Page/` | 页面容器 | `title`、`contentFullHeight` |
|
||||
| CountTo | `components/CountTo/` | 数字动画 | `startVal`、`endVal`、`duration` |
|
||||
| Qrcode | `components/Qrcode/` | 二维码 | `value`、`size`、`level` |
|
||||
| Icon | `components/icon/` | 图标选择器 | `value`、`disabled` |
|
||||
| 组件 | 职责 |
|
||||
|---|---|
|
||||
| Page | 页面容器(标题/内容区/响应高度) |
|
||||
| Modal | 弹窗封装(新增/编辑常用) |
|
||||
| Form | 表单容器(布局/重置/提交) |
|
||||
| Table | 数据表格封装(列配置/加载/选择) |
|
||||
| pagination | 分页条(pageNo/pageSize 契约) |
|
||||
|
||||
## 数据录入
|
||||
|
||||
| 组件 | 路径 | 说明 | 核心 Props |
|
||||
|------|------|------|-----------|
|
||||
| BasicForm | `components/Form/` | 动态表单 | `schemas`、`labelWidth` |
|
||||
| BasicModal | `components/Modal/` | 弹窗 | `title`、`width`、`okText` |
|
||||
| BasicUpload | `components/Upload/` | 文件上传 | `action`、`maxCount`、`accept` |
|
||||
| Editor | `components/Editor/` | 富文本编辑器 | `value`、`height`、`placeholder` |
|
||||
| Password | `components/Password/` | 密码强度 | `value`、`placeholder` |
|
||||
| ChinaArea | `components/ChinaArea/` | 省市区联动 | `value`、`placeholder` |
|
||||
| Region | `components/Region/` | 行政区划 | `value`、`level` |
|
||||
| Cropper | `components/Cropper/` | 头像裁剪 | `image`、`aspectRatio` |
|
||||
| NumberInput | `components/numberInput/` | 数字输入 | `value`、`min`、`max` |
|
||||
| PriceInput | `components/priceInput/` | 价格输入 | `value`、`precision` |
|
||||
| 组件 | 职责 |
|
||||
|---|---|
|
||||
| Select | 下拉(支持字典数据源) |
|
||||
| TableSelect | 表格选择器(选人/选部门,单/多选) |
|
||||
| Upload | 文件/图片上传(两段式契约) |
|
||||
| Editor | 富文本(TinyMCE / vue-quill 双引擎) |
|
||||
| Cropper | 图片裁剪 |
|
||||
| Password | 密码输入 |
|
||||
| numberInput / priceInput | 数字/金额输入(精度控制) |
|
||||
| ChinaArea / Region | 省市区级联 |
|
||||
|
||||
## Excel
|
||||
## 数据展示
|
||||
|
||||
| 组件 | 路径 | 说明 |
|
||||
|------|------|------|
|
||||
| ImportExcel | `components/Excel/` | Excel 导入(解析文件) |
|
||||
| Export2Excel | `components/Excel/` | Excel 导出(生成文件) |
|
||||
| 组件 | 职责 |
|
||||
|---|---|
|
||||
| CountTo | 数字滚动动画 |
|
||||
| Qrcode | 二维码生成 |
|
||||
| Render | 配置化/函数式渲染 |
|
||||
| icon | 图标(菜单与页面统一入口) |
|
||||
|
||||
## 其他
|
||||
## 功能性
|
||||
|
||||
| 组件 | 路径 | 说明 |
|
||||
|------|------|------|
|
||||
| Authority | `components/Authority/` | 权限组件(根据权限显示/隐藏) |
|
||||
| CheckToken | `components/CheckToken/` | Token 校验组件 |
|
||||
| Lockscreen | `components/Lockscreen/` | 锁屏组件 |
|
||||
| Websocket | `components/Websocket/` | WebSocket 组件 |
|
||||
| 组件 | 职责 |
|
||||
|---|---|
|
||||
| Authority | 权限包装(组件式权限控制) |
|
||||
| CheckToken | 令牌校验 |
|
||||
| Websocket | WebSocket 封装(实时推送) |
|
||||
| Lockscreen | 锁屏 |
|
||||
| Application | 应用级注入 |
|
||||
| importFile | 导入文件交互 |
|
||||
| Excel | 前端 Excel 解析/生成 |
|
||||
|
||||
## 使用示例
|
||||
## 速览入口
|
||||
|
||||
### BasicTable
|
||||
组件 props 与用法以各组件源码注释为准(`ui/src/components/{名}`)。典型组合见:
|
||||
|
||||
```vue
|
||||
<template>
|
||||
<BasicTable @register="registerTable" />
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { BasicTable, useTable } from '@/components/Table';
|
||||
|
||||
const [registerTable] = useTable({
|
||||
api: getExamplePage,
|
||||
columns: [
|
||||
{ title: 'ID', field: 'id', width: 80 },
|
||||
{ title: '名称', field: 'name' },
|
||||
{ title: '状态', field: 'statusText', width: 100 },
|
||||
],
|
||||
});
|
||||
</script>
|
||||
```
|
||||
|
||||
### BasicForm
|
||||
|
||||
```vue
|
||||
<template>
|
||||
<BasicForm @register="registerForm" />
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { BasicForm, useForm } from '@/components/Form';
|
||||
|
||||
const [registerForm] = useForm({
|
||||
schemas: [
|
||||
{ field: 'name', label: '名称', component: 'Input', required: true },
|
||||
{ field: 'status', label: '状态', component: 'Select', componentProps: { options: [...] } },
|
||||
],
|
||||
});
|
||||
</script>
|
||||
```
|
||||
|
||||
### BasicModal
|
||||
|
||||
```vue
|
||||
<template>
|
||||
<BasicModal @register="registerModal" @ok="handleSubmit" />
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { BasicModal, useModal } from '@/components/Modal';
|
||||
|
||||
const [registerModal, { openModal, closeModal }] = useModal();
|
||||
|
||||
const handleAdd = () => openModal(true, { isUpdate: false });
|
||||
const handleSubmit = async () => { /* ... */ closeModal(); };
|
||||
</script>
|
||||
```
|
||||
- [9.9 表格与页面组件](/zh/frontend/table-components.html)
|
||||
- [9.10 数据录入组件](/zh/frontend/form-components.html)
|
||||
- [9.11 数据展示组件](/zh/frontend/display-components.html)
|
||||
- [9.12 Excel 导入导出组件](/zh/frontend/excel-components.html)
|
||||
|
||||
Reference in New Issue
Block a user