Răsfoiți Sursa

release: docs release

陈凯龙 3 ani în urmă
părinte
comite
95a59f3c6a

+ 55 - 0
.github/workflows/main.yml

@@ -0,0 +1,55 @@
+name: deploy
+
+on:
+  push:
+    branches:
+      - master
+
+jobs:
+  push-to-gh-pages:
+    runs-on: ubuntu-latest
+    steps:
+      - name: Checkout
+        uses: actions/checkout@v2
+
+      - name: use Node.js 16
+        uses: actions/setup-node@v2.1.2
+        with:
+          node-version: '16.x'
+
+      - name: Get yarn cache
+        id: yarn-cache
+        run: echo "::set-output name=dir::$(yarn cache dir)"
+
+      - name: Cache dependencies
+        uses: actions/cache@v2
+        with:
+          path: ${{ steps.yarn-cache.outputs.dir }}
+          key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
+          restore-keys: |
+            ${{ runner.os }}-yarn-
+
+      - name: Set SSH Environment
+        env:
+          DOCS_DEPLOY_KEY: ${{ secrets.ACTIONS_DEPLOY_KEY }}
+        run: |
+          mkdir -p ~/.ssh/
+          echo "$ACTIONS_DEPLOY_KEY" > ~/.ssh/id_rsa
+          chmod 600 ~/.ssh/id_rsa
+          ssh-keyscan github.com > ~/.ssh/known_hosts
+          chmod 700 ~/.ssh && chmod 600 ~/.ssh/*
+          git config --local user.email "321200875@qq.com"
+          git config --local user.name "kailong321200875"
+
+      - name: Build
+        run: |
+          yarn install
+          yarn run build
+
+      - name: Deploy
+        uses: peaceiris/actions-gh-pages@v3
+        with:
+          deploy_key: ${{secrets.ACTIONS_DEPLOY_KEY}}
+          publish_branch: gh-pages
+          publish_dir: ./.vitepress/dist
+          keep_files: true

+ 74 - 5
.vitepress/config.js

@@ -76,24 +76,44 @@ function createNav() {
           link: '/components/introduction',
         },
         {
-          text: '功能组件',
+          text: '全局组件',
           link: '/components/icon',
         },
+        {
+          text: '功能组件',
+          link: '/components/form',
+        },
+        {
+          text: '函数式',
+          link: '/components/image-viewer',
+        },
       ],
     },
     {
       text: '相关链接',
       items: [
         {
-          text: '完整版预览',
+          text: 'Github 站点预览',
+          link: 'https://element-plus-admin.cn/',
+        },
+        {
+          text: 'Github 源码',
+          link: 'https://github.com/kailong321200875/vue-element-plus-admin',
+        },
+        {
+          text: 'Github 文档源码',
+          link: 'https://github.com/kailong321200875/vue-element-plus-admin-doc',
+        },
+        {
+          text: 'Gitee 站点预览',
           link: 'https://element-plus-admin.cn/',
         },
         {
-          text: '完整版源码',
+          text: 'Gitee 源码',
           link: 'https://github.com/kailong321200875/vue-element-plus-admin',
         },
         {
-          text: '文档源码',
+          text: 'Gitee 文档源码',
           link: 'https://github.com/kailong321200875/vue-element-plus-admin-doc',
         },
         {
@@ -127,12 +147,61 @@ function createSidebar() {
         ],
       },
       {
-        text: '常用组件',
+        text: '功能组件',
         children: [
           {
             text: 'Form 表单组件',
             link: '/components/form',
           },
+          {
+            text: 'Table 表格组件',
+            link: '/components/Table',
+          },
+          {
+            text: 'Editor 富文本组件',
+            link: '/components/editor',
+          },
+          {
+            text: 'Search 查询组件',
+            link: '/components/search',
+          },
+          {
+            text: 'Descriptions 描述组件',
+            link: '/components/descriptions',
+          },
+          {
+            text: 'Dialog 弹窗组件',
+            link: '/components/dialog',
+          },
+          {
+            text: 'Echart 图表组件',
+            link: '/components/echart',
+          },
+          {
+            text: 'CountTo 数字动画组件',
+            link: '/components/count-to',
+          },
+          {
+            text: 'Qrcode 二维码组件',
+            link: '/components/qrcode',
+          },
+          {
+            text: 'Highlight 高亮组件',
+            link: '/components/highlight',
+          },
+          {
+            text: 'Infotip 信息提示组件',
+            link: '/components/infotip',
+          }
+        ],
+      },
+      {
+        text: '函数式组件',
+        children: [
+          {
+            text: 'ImageViewer 图片预览组件',
+            link: '/components/image-viewer',
+          },
         ],
       },
     ],

+ 34 - 0
components/count-to.md

@@ -0,0 +1,34 @@
+# CountTo 数字动画组件
+
+基于 `vue-count-to` 改造
+
+## 用法
+
+更复杂点的例子,请[在线预览](https://element-plus-admin.cn/#/components/count-to)
+
+```vue
+<script setup lang="ts">
+import { CountTo } from '@/components/CountTo'
+</script>
+
+<template>
+  <CountTo :start-val="0" :end-val="35225" />
+</template>
+
+```
+
+## CountTo 属性
+
+| 属性 | 说明 | 类型 | 可选值 | 默认值 |
+| ---- | ---- | ---- | ---- | ---- |
+| startVal | 初始值 | `number` | - | 0 |
+| endVal | 最后展示的值 | `number` | - | 2021 |
+| duration | 动画时间 | `number` | - | 3000 |
+| autoplay | 是否自动播放 | `boolean` | - | true |
+| decimals | 小位数 | `number` | - | 0 |
+| decimal | 小位数分割符号 | `string` | - | . |
+| separator | 分割符号 | `string` | - | , |
+| prefix | 前缀 | `string` | - | - |
+| suffix | 后缀 | `string` | - | - |
+| useEasing | 过渡动画 | `boolean` | - | true |
+| easingFn | 自定义动画效果 | `(t: number, b: number, c: number, d: number) => number` | - | - |

+ 93 - 0
components/descriptions.md

@@ -0,0 +1,93 @@
+# Descriptions 描述组件
+
+对 `element-plus` 的 `Descriptions` 组件进行封装。
+
+## 用法
+
+更复杂点的例子,请[在线预览](https://element-plus-admin.cn/#/components/descriptions)
+
+```vue
+<script setup lang="ts">
+import { Descriptions } from '@/components/Descriptions'
+import { reactive } from 'vue'
+
+const data = reactive({
+  username: 'chenkl',
+  nickName: '梦似花落。',
+  age: 26,
+  phone: '13655971xxxx',
+  email: '502431556@qq.com',
+  addr: '这是一个很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长的地址',
+  sex: '男',
+  certy: '3505831994xxxxxxxx'
+})
+
+const schema = reactive<DescriptionsSchema[]>([
+  {
+    field: 'username',
+    label: 'username'
+  },
+  {
+    field: 'nickName',
+    label: 'nickName'
+  },
+  {
+    field: 'phone',
+    label: 'phone'
+  },
+  {
+    field: 'email',
+    label: 'email'
+  },
+  {
+    field: 'addr',
+    label: 'addr',
+    span: 24
+  }
+])
+</script>
+
+<template>
+  <Descriptions
+    title="descriptions"
+    message="message"
+    :data="data"
+    :schema="schema"
+  />
+</template>
+
+```
+
+## Descriptions 属性
+
+除以下参数外,还支持 `element-plus` 的 `Descriptions` 所有属性,[详见](https://element-plus.org/zh-CN/component/descriptions.html#descriptions-%E5%B1%9E%E6%80%A7)
+
+| 属性 | 说明 | 类型 | 可选值 | 默认值 |
+| ---- | ---- | ---- | ---- | ---- |
+| title | 标题 | `string` | - | - |
+| message | 提示 | `string` | - | - |
+| collapse | 是否显示展开按钮 | `boolean` | - | true |
+| autoSetPlaceholder | 是否自动设置 placeholder | `boolean` | - | true |
+| schema | 布局结构数据,[详见](#Schema) | `DescriptionsSchema[]` | - | [] |
+| data | 展示的数据 | `Recordable` | - | {} |
+
+### Schema<span id="Schema"></span>
+
+| 属性 | 说明 | 类型 | 可选值 | 默认值 |
+| ---- | ---- | ---- | ---- | ---- |
+| span | 栅格占比 | `number` | - | - |
+| field | 字段名,唯一值,需要与 data 中的属性名对应 | `string` | - | - |
+| label | 列表标题 | `string` | - | - |
+| width | 列表宽度 | `string`/`number` | - | - |
+| minWidth | 列表最小宽度 | `string`/`number` | - | - |
+| align | 内容对齐方式 | `string` | left/center/right | left |
+| labelAlign | 标题对齐方式 | `string` | left/center/right | left |
+| className | 自定义内容标签类名 | `string` | - | - |
+| labelClassName | 自定义标题标签类名 | `string` | - | - |
+
+## Descriptions 插槽
+
+| 插槽名 | 说明 | 子标签 |
+| ---- | ---- | ---- |
+| ${field} | 自定义内容 | - |
+| ${field}-label | 自定义标题| - |

+ 47 - 0
components/dialog.md

@@ -0,0 +1,47 @@
+# Dialog 弹窗组件
+
+对 `element-plus` 的 `Dialog` 组件进行封装。
+
+## 用法
+
+```vue
+<script setup lang="ts">
+import { Dialog } from '@/components/Dialog'
+import { ElButton } from 'element-plus'
+import { ref } from 'vue'
+
+const dialogVisible = ref(false)
+</script>
+
+<template>
+  <ElButton type="primary" @click="dialogVisible = !dialogVisible">
+    open
+  </ElButton>
+  <Dialog v-model="dialogVisible" title="dialog">
+    <div v-for="v in 10000" :key="v">{{ v }}</div>
+    <template #footer>
+      <el-button @click="dialogVisible = false">close</el-button>
+    </template>
+  </Dialog>
+</template>
+
+```
+
+## Dialog 属性
+
+除以下参数外,还支持 `element-plus` 的 `Dialog` 所有属性,[详见](https://element-plus.org/zh-CN/component/dialog.html#%E5%B1%9E%E6%80%A7)
+
+| 属性 | 说明 | 类型 | 可选值 | 默认值 |
+| ---- | ---- | ---- | ---- | ---- |
+| modelValue | 是否显示弹窗,支持v-model | `boolean` | - | false |
+| fullscreen | 是否显示全屏按钮 | `boolean` | - | true |
+| title | 弹窗标题 | `string` | - | Dialog |
+| maxHeight | 弹窗内容最大高度 | `string`/`number` | - | 500px |
+
+## Dialog 插槽
+
+| 插槽名 | 说明 | 子标签 |
+| ---- | ---- | ---- |
+| - | 弹窗内容 | - |
+| title | 弹窗标题内容 | - |
+| footer | 弹窗底部内容 | - |

+ 21 - 0
components/echart.md

@@ -0,0 +1,21 @@
+# Echart 图表组件
+
+对 `echarts` 进行封装,自适应窗口大小。
+
+## 用法
+
+只需传入对应的 `options` 和 `height` 即可展示图表。
+
+```vue
+<template>
+  <Echart :options="pieOptions" :height="300" />
+</template>
+```
+
+## Echart 属性
+
+| 属性 | 说明 | 类型 | 可选值 | 默认值 |
+| ---- | ---- | ---- | ---- | ---- |
+| options | echart 对应的配置项,[详见](https://echarts.apache.org/zh/option.html#title) | `EChartsOption` | - | [] |
+| width | 图表宽度 | `string`/`number` | - | - |
+| height | 图表高度 | `string`/`number` | - | 500 |

+ 44 - 0
components/editor.md

@@ -0,0 +1,44 @@
+# Editor 富文本组件
+
+基于 [wangeditor](https://www.wangeditor.com/) 封装。
+
+目前项目中的 `editor` 只是做了简单的封装,需要开发者根据实际情况,自行配置 `editorConfig` 属性,如,上传图片功能。
+
+可自行阅读 [wangeditor文档](https://www.wangeditor.com/v5/)
+
+## 用法
+
+```vue
+<script setup lang="ts">
+import { Editor } from '@/components/Editor'
+import { ref} from 'vue'
+
+const defaultHtml = ref('<p>hello <strong>world</strong></p>')
+</script>
+
+<template>
+  <Editor :defaultHtml="defaultHtml" />
+</template>
+
+```
+
+## Editor 属性
+
+| 属性 | 说明 | 类型 | 可选值 | 默认值 |
+| ---- | ---- | ---- | ---- | ---- |
+| editorId | 富文本组件唯一值,必填项 | `string` | - | wangeEditor-1 |
+| height | 高度 | `string`/`number` | - | 500px |
+| editorConfig | wangeditor 组件的所有配置项 | `IEditorConfig` | - | - |
+| defaultHtml | 初始内容 | `string` | - | - |
+
+## Editor 事件
+
+| 方法名 | 说明 | 回调参数 |
+| ---- | ---- | ---- |
+| change | 内容改变时,返回 editor 实例 | editor: IDomEditor |
+
+## Editor 方法
+
+| 方法名 | 说明 | 回调参数 |
+| ---- | ---- | ---- |
+| getEditorRef | 获取 editor 实例 | `() => Promise<IDomEditor>` |

+ 6 - 2
components/form.md

@@ -65,13 +65,17 @@ const { register } = useForm({
 const { register, elFormRef, methods } = useForm(props)
 ```
 
+**props**
+
+[详见](#Form)
+
 **register**
 
 `register` 用于注册 `useForm`,如果需要使用 `useForm` 提供的 `api`,必须将 `register` 传入组件的 `onRegister`
 
 **elFormRef**
 
-当前 `elForm` 实例,可用所有 `elForm` 实例方法。
+当前 `elForm` 实例,可使用所有 `elForm` 实例方法。
 
 **methods**
 
@@ -84,7 +88,7 @@ const { register, elFormRef, methods } = useForm(props)
 | setSchema | 用于编辑表单结构 | (schemaProps: FormSetPropsType[]) => void |
 | getFormData | 用于获取表单数据 | <T = Recordable | undefined>() => Promise<T> |
 
-## Form 属性
+## Form 属性<span id="Form"></span>
 
 除以下参数外,还支持 `element-plus` 的 `Form` 所有属性,[详见](https://element-plus.org/zh-CN/component/form.html#form-%E5%B1%9E%E6%80%A7)
 

+ 32 - 0
components/highlight.md

@@ -0,0 +1,32 @@
+# Highlight 高亮组件
+
+## 用法
+
+组件只能接收纯文本。
+
+```vue
+<script setup lang="ts">
+import { Highlight } from '@/components/Highlight'
+</script>
+
+<template>
+  <Highlight :keys="['十年前', '现在']">
+    种一棵树最好的时间是十年前,其次就是现在。
+  </Highlight>
+</template>
+
+```
+
+## Highlight 属性
+
+| 属性 | 说明 | 类型 | 可选值 | 默认值 |
+| ---- | ---- | ---- | ---- | ---- |
+| tag | 包裹标签 | `string` | - | span |
+| keys | 高亮的关键字 | `string[]` | - | [] |
+| color | 高亮的颜色 | `string` | - | var(--el-color-primary) |
+
+## Highlight 事件
+
+| 方法名 | 说明 | 回调参数 |
+| ---- | ---- | ---- |
+| click | 关键字点击事件 | key: string |

+ 44 - 0
components/image-viewer.md

@@ -0,0 +1,44 @@
+# ImageViewer 图片预览组件
+
+将 `element-plus` 的 `ImageViewer` 组件函数化,通过函数方便创建组件。
+
+## 用法
+
+```vue
+<script setup lang="ts">
+import { createImageViewer } from '@/components/ImageViewer'
+import { ElButton } from 'element-plus'
+
+const open = () => {
+  createImageViewer({
+    urlList: [
+      'https://img1.baidu.com/it/u=657828739,1486746195&fm=26&fmt=auto&gp=0.jpg',
+      'https://img0.baidu.com/it/u=3114228356,677481409&fm=26&fmt=auto&gp=0.jpg',
+      'https://img1.baidu.com/it/u=508846955,3814747122&fm=26&fmt=auto&gp=0.jpg',
+      'https://img1.baidu.com/it/u=3536647690,3616605490&fm=26&fmt=auto&gp=0.jpg',
+      'https://img1.baidu.com/it/u=4087287201,1148061266&fm=26&fmt=auto&gp=0.jpg',
+      'https://img2.baidu.com/it/u=3429163260,2974496379&fm=26&fmt=auto&gp=0.jpg'
+    ]
+  })
+}
+</script>
+
+<template>
+  <ElButton type="primary" @click="open">预览</ElButton>
+</template>
+
+```
+
+## createImageViewer
+
+### 参数
+
+| 属性 | 说明 | 类型 | 可选值 | 默认值 |
+| ---- | ---- | ---- | ---- | ---- |
+| urlList | 图片列表 | `string[]` | - | - |
+| zIndex | 层级 | `number` | - | - |
+| initialIndex | 默认展示第几张 | `number` | - | 1 |
+| infinite | 是否可以循环切换 | `boolean` | - | true |
+| hideOnClickModal | 点击蒙版是否关闭 | `boolean` | - | false |
+| appendToBody | 是否添加到 body 中 | `boolean` | - | false |
+| show | 是否显示图片预览 | `boolean` | - | false |

+ 43 - 0
components/infotip.md

@@ -0,0 +1,43 @@
+# Infotip 信息提示组件
+
+基于 `Highlight` 组件封装。
+
+## 用法
+
+```vue
+<script setup lang="ts">
+import { Infotip } from '@/components/Infotip'
+</script>
+
+<template>
+  <Infotip
+    title="推荐使用Iconify组件"
+    :schema="[
+      {
+        label: 'Iconify组件基本包含所有的图标,你可以查询到你想要的任何图标。并且打包只会打包所用到的图标。',
+        keys: ['Iconify']
+      },
+      {
+        label: '访问地址',
+        keys: ['访问地址']
+      }
+    ]"
+  />
+</template>
+
+```
+
+## Infotip 属性
+
+| 属性 | 说明 | 类型 | 可选值 | 默认值 |
+| ---- | ---- | ---- | ---- | ---- |
+| title | 标题 | `string` | - | - |
+| schema | 展示的数据内容 | `string[]`/`TipSchema[]` | - | [] |
+| showIndex | 显示序号 | `boolean` | - | true |
+| highlightColor | 高亮颜色 | `string` | - | var(--el-color-primary) |
+
+## Infotip 事件
+
+| 方法名 | 说明 | 回调参数 |
+| ---- | ---- | ---- |
+| click | 关键字点击事件 | key: string |

+ 38 - 0
components/qrcode.md

@@ -0,0 +1,38 @@
+# Qrcode 二维码组件
+
+基于 `qrcode` 封装。
+
+## 用法
+
+更复杂点的例子,请[在线预览](https://element-plus-admin.cn/#/components/qrcode)
+
+```vue
+<script setup lang="ts">
+import { Qrcode } from '@/components/Qrcode'
+</script>
+
+<template>
+  <Qrcode text="vue-element-plus-admin" />
+</template>
+
+```
+
+## Qrcode 属性
+
+| 属性 | 说明 | 类型 | 可选值 | 默认值 |
+| ---- | ---- | ---- | ---- | ---- |
+| tag | 以什么标签生成二维码 | `string` | canvas/img | canvas |
+| text | 二维码内容 | `string`/`Array` | - | - |
+| options | qrcode.js 配置项 | `QRCodeRenderersOptions` | - | {} |
+| width | 二维码宽度 | `number` | - | 200 |
+| logo | 二维码 logo | `QrcodeLogo`/`string` | - | - |
+| disabled | 二维码是否过期 | `boolean` | - | false |
+| disabledText | 二维码过期提示内容 | `string` | - | - |
+
+## Qrcode 事件
+
+| 方法名 | 说明 | 回调参数 |
+| ---- | ---- | ---- |
+| done | 生成二维码后的回调 | - |
+| click | 二维码点击事件 | - |
+| disabled-click | 二维码过期后点击事件 | - |

+ 48 - 0
components/search.md

@@ -0,0 +1,48 @@
+# Search 查询组件
+
+基于 `Form` 组件封装,支持收缩展开。
+
+## 用法
+
+更复杂例子,请[在线预览](https://element-plus-admin.cn/#/components/search)
+
+```vue
+<script setup lang="ts">
+import { Search } from '@/components/Search'
+import { reactive } from 'vue'
+
+const schema = reactive<FormSchema[]>([
+  {
+    field: 'field1',
+    label: 'input',
+    component: 'Input'
+  }
+])
+</script>
+
+<template>
+  <Search :schema="schema" />
+</template>
+
+```
+
+## Search 属性
+
+| 属性 | 说明 | 类型 | 可选值 | 默认值 |
+| ---- | ---- | ---- | ---- | ---- |
+| schema | 生成 Search 的布局结构数组,[详见](#Schema) | `FormSchema` | - | [] |
+| isCol | 是否需要栅格布局 | `boolean` | - | true |
+| labelWidth | 表单 label 宽度 | `string`/`number` | - | auto |
+| layout | 操作按钮风格位置 | `string` | inline/bottom | inline |
+| buttomPosition | 底部操作按钮的对齐方式 | `string` | left/center/right | center |
+| showSearch | 是否显示查询按钮 | `boolean` | - | true |
+| showReset | 是否显示重置按钮 | `boolean` | - | true |
+| expand | 是否显示伸缩按钮 | `boolean` | - | false |
+| expandField | 伸缩的界限字段 | `string` | - | - |
+
+## Search 事件
+
+| 方法名 | 说明 | 回调参数 |
+| ---- | ---- | ---- |
+| search | 查询后的回调 | data: Recordable |
+| reset | 重置后的回到 | data: Recordable |

+ 296 - 0
components/table.md

@@ -0,0 +1,296 @@
+# Table 表格组件
+
+对 `element-plus` 的 `Table` 组件进行封装,只需传入 `columns` 与 `data` 参数,即可渲染出响应的表格出来。
+
+Table 组件位于 [src/components/Table](https://github.com/kailong321200875/vue-element-plus-admin/tree/master/src/components/Table) 内
+
+## 用法
+
+```vue
+<script setup lang="ts">
+import { reactive } from 'vue'
+
+const columns = reactive<TableColumn[]>([
+  {
+    field: 'index',
+    label: 'index',
+    type: 'index'
+  },
+  {
+    field: 'title',
+    label: 'title'
+  },
+  {
+    field: 'author',
+    label: 'author'
+  },
+  {
+    field: 'action',
+    label: 'action'
+  }
+])
+
+const data = reactive([
+  {
+    title: 'title1',
+    author: 'author1'
+  },
+  {
+    title: 'title2',
+    author: 'author2'
+  },
+  {
+    title: 'title2',
+    author: 'author2'
+  }
+])
+</script>
+
+<template>
+  <Table :columns="columns" :data="data" />
+</template>
+
+```
+
+### refTable
+
+如果只使用 `refTable`,所有参数都需要手动传入到 `Table` 组件中,推荐配合 `useTable` 使用。
+
+### useTable
+
+复杂点的例子,请[在线预览](https://element-plus-admin.cn/#/components/table/use-table)
+
+```vue
+<script setup lang="ts">
+import { Table } from '@/components/Table'
+import { getTableListApi } from '@/api/table'
+import { TableData } from '@/api/table/types'
+import { reactive } from 'vue'
+import { useTable } from '@/hooks/web/useTable'
+
+const columns = reactive<TableColumn[]>([
+  {
+    field: 'index',
+    label: 'index',
+    type: 'index'
+  },
+  {
+    field: 'title',
+    label: 'title'
+  },
+  {
+    field: 'author',
+    label: 'author'
+  },
+  {
+    field: 'display_time',
+    label: 'displayTime'
+  },
+  {
+    field: 'pageviews',
+    label: 'pageviews'
+  },
+  {
+    field: 'action',
+    label: 'action'
+  }
+])
+
+const { register, tableObject, methods } = useTable<
+  {
+    total: number
+    list: TableData[]
+  },
+  TableData
+>({
+  getListApi: getTableListApi,
+  response: {
+    list: 'list',
+    total: 'total'
+  },
+  props: {
+    columns
+  }
+})
+
+const { getList } = methods
+
+getList()
+</script>
+
+<template>
+  <Table
+    v-model:pageSize="tableObject.pageSize"
+    v-model:currentPage="tableObject.currentPage"
+    :data="tableObject.tableList"
+    :loading="tableObject.loading"
+    :pagination="{
+      total: tableObject.total
+    }"
+    @register="register"
+  />
+</template>
+
+```
+
+#### 参数介绍
+
+```ts
+
+interface Response {
+  total: number
+  list: TableData[]
+}
+
+const { register, tableObject, methods, elTableRef } = useTable<Response, TableData>(props: UseTableConfig)
+```
+
+**useTable** 可以传入自定义类型 `<T, K, L extends AxiosConfig = AxiosConfig>`
+
+- T 代表接口返回的数据类型。
+- K 代表接口返回的表格数据类型。
+- L 代表接口请求参数的类型。
+
+在实际需求中,可能会遇到分页参数命名不同的情况,请自行在 [src/hooks/web/useTable.ts](https://github.com/kailong321200875/vue-element-plus-admin/tree/master/src/hooks/web/useTable.ts) 进行替换,搜索 `pageSize` 及 `pageIndex`。
+
+**props**
+
+在使用 `useTable` 的时候,可以在 `props` 中传入 `getListApi`,以及 `response`,之后就可以手动调用 `methods.getList()` 方法请求表格数据了。每次表格分页时,则会自动调用接口。
+
+如果需要使用删除方法 `methods.delList()`,则需要在 `props` 中传入 `delListApi` 参数,用于删除时调用接口,目前本项目中单条删除或者批量删除,都是同样的接口同样的参数。如果与实际需求不符,可以自行改造。在 [src/hooks/web/useTable.ts](https://github.com/kailong321200875/vue-element-plus-admin/tree/master/src/hooks/web/useTable.ts) 的 `delList` 以及 `delData` 中修改。
+
+```ts
+// 删除数据
+delList: async (ids: string[] | number[], multiple: boolean, message = true) => {
+  const tableRef = await getTable()
+  if (multiple) {
+    if (!tableRef?.selections.length) {
+      ElMessage.warning(t('common.delNoData'))
+      return
+    }
+  } else {
+    if (!tableObject.currentRow) {
+      ElMessage.warning(t('common.delNoData'))
+      return
+    }
+  }
+  const paramsObj: AxiosConfig = {
+    data: {
+      ids
+    }
+  }
+  if (message) {
+    ElMessageBox.confirm(t('common.delMessage'), t('common.delWarning'), {
+      confirmButtonText: t('common.delOk'),
+      cancelButtonText: t('common.delCancel'),
+      type: 'warning'
+    })
+      .then(async () => {
+        await delData(paramsObj, ids)
+      })
+      .catch(() => {})
+  } else {
+    await delData(paramsObj, ids)
+  }
+}
+```
+
+```ts
+const delData = async (paramsObj: AxiosConfig, ids: string[] | number[]) => {
+  const res = await (config?.delListApi && config?.delListApi(paramsObj))
+  if (res) {
+    ElMessage.success(t('common.delSuccess'))
+
+    // 计算出临界点
+    const currentPage =
+      tableObject.total % tableObject.pageSize === ids.length || tableObject.pageSize === 1
+        ? tableObject.currentPage > 1
+          ? tableObject.currentPage - 1
+          : tableObject.currentPage
+        : tableObject.currentPage
+
+    tableObject.currentPage = currentPage
+    methods.getList()
+  }
+}
+```
+
+**register**
+
+`register` 用于注册 `useTable`,如果需要使用 `useTable` 提供的 `api`,必须将 `register` 传入组件的 `onRegister`
+
+**tableObject**
+
+表格对象
+
+| 属性 | 说明 | 类型 | 可选值 | 默认值 |
+| ---- | ---- | ---- | ---- | ---- |
+| pageSize | 每页显示多少条 | `number` | - | 10 |
+| currentPage | 当前页 | `number` | - | 1 |
+| total | 总条数 | `number` | - | - |
+| tableList | 表格数据 | `K[]` | - | [] |
+| parmasObj | AxiosConfig 配置 | `L` | - | {} |
+| loading | 表格是否加载中 | `boolean` | - | false |
+| currentRow | 当前选中数据 | `Nullable<K>` | - | - |
+
+**methods**
+
+| 方法名 | 说明 | 回调参数 |
+| ---- | ---- | ---- |
+| setProps | 用于表格组件属性 | (props: Recordable) => void |
+| getList | 获取表格数据 | `() => Promise<void>` |
+| setColumn | 设置表头结构 | (columnProps: TableSetPropsType[]) => void |
+| setSearchParmas | 与 Search 组件配置,用于获取 Search 组件返回的查询数据 | (data: Recordable) => void |
+| getSelections | 获取多选数据 | () => Promise<K[]> |
+| delList | 删除数据接口 | `(ids: string[], multiple: boolean, message?: boolean) => Promise<void>` |
+
+**elTableRef**
+
+当前 `elTable` 实例,可使用所有 `elTable` 实例方法。
+
+## Table 属性
+
+除以下参数外,还支持 `element-plus` 的 `Table` 所有属性,[详见](https://element-plus.org/zh-CN/component/table.html#table-attributes)
+
+| 属性 | 说明 | 类型 | 可选值 | 默认值 |
+| ---- | ---- | ---- | ---- | ---- |
+| pageSize | 每页显示多少条,支持 v-model 双向绑定 | `number` | - | 10 |
+| currentPage | 当前页,支持 v-model 双向绑定 | `number` | - | 1 |
+| selection | 是否多选 | `boolean` | - | true |
+| showOverflowTooltip | 是否所有的超出隐藏,优先级低于 schema 中的 showOverflowTooltip  | `boolean` | - | true |
+| columns | 表头结构,[详见](#Columns) | `TableColumn[]` | - | [] |
+| expand | 是否显示展开行 | `boolean` | - | false |
+| pagination | 是否展示分页,[详见](#Pagination) | `Pagination`/`undefined` | - | - |
+| reserveSelection | 仅对 type=selection 的列有效,类型为 Boolean,为 true 则会在数据更新之后保留之前选中的数据(需指定 row-key) | `boolean` | - | false |
+| loading | 加载状态 | `boolean` | - | false |
+| reserveIndex | 是否叠加索引 | `boolean` | - | false |
+| align | 内容对齐方式 | `string` | `left`/`center`/`right` | left |
+| headerAlign | 表头对齐方式 | `string` | `left`/`center`/`right` | left |
+| data | 表格数据 | `Recordable[]` | - | [] |
+
+### Columns<span id="Columns"></span>
+
+| 属性 | 说明 | 类型 | 可选值 | 默认值 |
+| ---- | ---- | ---- | ---- | ---- |
+| field | 唯一值,如需展示正确的数据,需要与 data 中的属性名对应 | `string` | - | - |
+| label | 表头名称 | `string` | - | - |
+| children | 子项,用于多级表头 | `TableColumn[]` | - | - |
+
+### Pagination<span id="Pagination"></span>
+
+支持 `element-plus` 的 `Pagination` 所有属性,[详见](https://element-plus.org/zh-CN/component/pagination.html#%E5%B1%9E%E6%80%A7)
+
+## Table 方法
+
+| 方法名 | 说明 | 回调参数 |
+| ---- | ---- | ---- |
+| setProps | 用于设置表格属性 | (props: Recordable) => void |
+| setColumn | 用于修改表头结构 | (columnProps: TableSetPropsType[]) => void |
+
+## Table 插槽
+
+| 插槽名 | 说明 | 子标签 |
+| ---- | ---- | ---- |
+| append | 插入至表格最后一行之后的内容, 如果需要对表格的内容进行无限滚动操作,可能需要用到这个 slot。 若表格有合计行,该 slot 会位于合计行之上。| - |
+| ${field} | 表格内容 | - |
+| ${field}-header | 表头内容 | - |