Sfoglia il codice sorgente

Merge branch 'master' of https://github.com/kailong321200875/vue-element-plus-admin-doc

kailong321200875 3 anni fa
parent
commit
57d8decc0b

+ 69 - 0
.github/workflows/deploy-gitee.yml

@@ -0,0 +1,69 @@
+name: Docs Deploy Gitee
+
+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:gitee
+
+      - name: Docs Deploy
+        uses: peaceiris/actions-gh-pages@v3
+        with:
+          deploy_key: ${{secrets.ACTIONS_DEPLOY_KEY}}
+          publish_branch: gh-pages-gitee
+          publish_dir: ./.vitepress/dist
+          force_orphan: true
+
+      - name: Sync Github Repos To Gitee # 名字随便起
+        uses: Yikun/hub-mirror-action@v1.1 # 使用Yikun/hub-mirror-action
+        with:
+          src: github/kailong321200875 # 源端账户名(github)
+          dst: gitee/kailong110120130 # 目的端账户名(gitee)
+          dst_key: ${{ secrets.ACTIONS_DEPLOY_KEY }} # SSH密钥对中的私钥
+          dst_token: ${{ secrets.GITEE_TOKEN }} # Gitee账户的私人令牌
+          account_type: user # 账户类型
+          clone_style: 'https' # 使用https方式进行clone,也可以使用ssh
+          debug: true # 启用后会显示所有执行命令
+          force_update: true # 启用后,强制同步,即强制覆盖目的端仓库
+          static_list: 'vue-element-plus-admin-doc' # 静态同步列表,在此填写需要同步的仓库名称,可填写多个
+          timeout: '600s' # git超时设置,超时后会自动重试git操作

+ 8 - 7
.github/workflows/main.yml → .github/workflows/deploy.yml

@@ -1,4 +1,4 @@
-name: docs-deploy
+name: Docs Deploy
 
 on:
   push:
@@ -12,16 +12,16 @@ jobs:
       - name: Checkout
         uses: actions/checkout@v2
 
-      - name: use Node.js 16
+      - name: Use Node.js 16
         uses: actions/setup-node@v2.1.2
         with:
           node-version: '16.x'
 
-      - name: Get yarn cache
+      - name: Get Yarn Cache
         id: yarn-cache
         run: echo "::set-output name=dir::$(yarn cache dir)"
 
-      - name: Cache dependencies
+      - name: Cache Dependencies
         uses: actions/cache@v2
         with:
           path: ${{ steps.yarn-cache.outputs.dir }}
@@ -44,12 +44,13 @@ jobs:
       - name: Build
         run: |
           yarn install
-          yarn run build
+          yarn run build:github
 
-      - name: Deploy
+      - name: Docs 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
+          force_orphan: true
+          cname: element-plus-admin-doc.cn

+ 17 - 9
.vitepress/config.js

@@ -3,7 +3,7 @@
  * @type {import('vitepress').UserConfig}
  */
 module.exports = {
-  base: '/',
+  base: (process.argv[3] && process.argv[3] === '--gitee') ? '/vue-element-plus-admin-doc/' : '/',
   title: 'vue-element-plus-admin',
   lang: 'zh-CN',
   description: '一套基于vue3、element-plus、typesScript4、vite2的后台集成方案',
@@ -12,7 +12,7 @@ module.exports = {
     repo: 'kailong321200875/vue-element-plus-adminc',
     docsRepo: 'kailong321200875/vue-element-plus-admin-doc',
     logo: '/logo.png',
-    docsBranch: 'main',
+    docsBranch: 'master',
     editLinks: true,
     editLinkText: '为此页提供修改建议',
     nav: createNav(),
@@ -114,21 +114,25 @@ function createNav() {
           text: 'Github 文档源码',
           link: 'https://github.com/kailong321200875/vue-element-plus-admin-doc',
         },
+        {
+          text: 'Github 更新日志',
+          link: 'https://github.com/kailong321200875/vue-element-plus-admin/blob/master/CHANGELOG.md',
+        },
         {
           text: 'Gitee 站点预览',
-          link: 'https://element-plus-admin.cn/',
+          link: 'https://kailong110120130.gitee.io/vue-element-plus-admin',
         },
         {
           text: 'Gitee 源码',
-          link: 'https://github.com/kailong321200875/vue-element-plus-admin',
+          link: 'https://gitee.com/kailong110120130/vue-element-plus-admin',
         },
         {
           text: 'Gitee 文档源码',
-          link: 'https://github.com/kailong321200875/vue-element-plus-admin-doc',
+          link: 'https://gitee.com/kailong110120130/vue-element-plus-admin-doc',
         },
         {
-          text: '更新日志',
-          link: 'https://github.com/kailong321200875/vue-element-plus-admin/blob/master/CHANGELOG.zh_CN.md',
+          text: 'Gitee 更新日志',
+          link: 'https://gitee.com/kailong110120130/vue-element-plus-admin/blob/master/CHANGELOG.md',
         },
       ],
     },
@@ -171,7 +175,7 @@ function createSidebar() {
           },
           {
             text: 'Table 表格组件',
-            link: '/components/Table',
+            link: '/components/table',
           },
           {
             text: 'Editor 富文本组件',
@@ -208,7 +212,11 @@ function createSidebar() {
           {
             text: 'Infotip 信息提示组件',
             link: '/components/infotip',
-          }
+          },
+          {
+            text: 'Error 缺省组件',
+            link: '/components/error',
+          },
         ],
       },
       {

+ 2 - 0
components/count-to.md

@@ -2,6 +2,8 @@
 
 基于 `vue-count-to` 改造
 
+CountTo 组件位于 [src/components/CountTo](https://github.com/kailong321200875/vue-element-plus-admin/tree/master/src/components/CountTo) 内
+
 ## 用法
 
 更复杂点的例子,请[在线预览](https://element-plus-admin.cn/#/components/count-to)

+ 2 - 0
components/descriptions.md

@@ -2,6 +2,8 @@
 
 对 `element-plus` 的 `Descriptions` 组件进行封装。
 
+Descriptions 组件位于 [src/components/Descriptions](https://github.com/kailong321200875/vue-element-plus-admin/tree/master/src/components/Descriptions) 内
+
 ## 用法
 
 更复杂点的例子,请[在线预览](https://element-plus-admin.cn/#/components/descriptions)

+ 2 - 0
components/dialog.md

@@ -2,6 +2,8 @@
 
 对 `element-plus` 的 `Dialog` 组件进行封装。
 
+Dialog 组件位于 [src/components/Dialog](https://github.com/kailong321200875/vue-element-plus-admin/tree/master/src/components/Dialog) 内
+
 ## 用法
 
 ```vue

+ 2 - 0
components/echart.md

@@ -2,6 +2,8 @@
 
 对 `echarts` 进行封装,自适应窗口大小。
 
+Echart 组件位于 [src/components/Echart](https://github.com/kailong321200875/vue-element-plus-admin/tree/master/src/components/Echart) 内
+
 ## 用法
 
 只需传入对应的 `options` 和 `height` 即可展示图表。

+ 2 - 0
components/editor.md

@@ -6,6 +6,8 @@
 
 可自行阅读 [wangeditor文档](https://www.wangeditor.com/v5/)
 
+Editor 组件位于 [src/components/Editor](https://github.com/kailong321200875/vue-element-plus-admin/tree/master/src/components/Editor) 内
+
 ## 用法
 
 ```vue

+ 36 - 0
components/error.md

@@ -0,0 +1,36 @@
+# Error 缺省组件
+
+用于各种占位图组件,如 `404`、`403`、`500` 等错误页面。
+
+Error 组件位于 [src/components/Error](https://github.com/kailong321200875/vue-element-plus-admin/tree/master/src/components/Error) 内
+
+## 用法
+
+```vue
+<script setup lang="ts">
+import { Error } from '@/components/Error'
+</script>
+
+<template>
+  <Error />
+</template>
+
+```
+
+## Error 属性
+
+| 属性 | 说明 | 类型 | 可选值 | 默认值 |
+| ---- | ---- | ---- | ---- | ---- |
+| type | 占位图类型 | `string` | - | 404 |
+
+## Error 事件
+
+| 方法名 | 说明 | 回调参数 |
+| ---- | ---- | ---- |
+| errorClick | 点击按钮后的回调 | - |
+
+## 如何扩展新类型
+
+目前只提供了 `404`、`403`、`500` 三种类型,如果不满足实际需求,可自行扩展。
+
+只需在 [src/components/Error/src/Error.vue](https://github.com/kailong321200875/vue-element-plus-admin/tree/master/src/components/Error/src/Error.vue) 文件的 `errorMap` 对象扩展对应类型即可。

+ 1 - 0
components/form.md

@@ -107,6 +107,7 @@ const { register, elFormRef, methods } = useForm(props)
 | ---- | ---- | ---- | ---- | ---- |
 | field | 唯一值,必填项 | `string` | - | - |
 | label | 标题 | `string` | - | - |
+| labelMessage (1.1.7新增) | 表单项说明 | `string` | - | - |
 | colProps | element-plus 的 col 组件属性 | `ColProps` | - | - |
 | componentProps | 表单组件子属性,[详见](#ComponentProps) | `{ slots?: Recordable } & ComponentProps` | - | - |
 | formItemProps | element-plus 的 form-item 组件属性,[详见](#FormItemProps) | `FormItemProps` | - | - |

+ 2 - 0
components/highlight.md

@@ -1,5 +1,7 @@
 # Highlight 高亮组件
 
+Highlight 组件位于 [src/components/Highlight](https://github.com/kailong321200875/vue-element-plus-admin/tree/master/src/components/Highlight) 内
+
 ## 用法
 
 组件只能接收纯文本。

+ 30 - 1
components/icon.md

@@ -12,6 +12,8 @@ Icon 组件位于 [src/components/Icon](https://github.com/kailong321200875/vue-
 
 ## 用法
 
+### 基本用法
+
 如果以`svg-icon:` 开头,则会在本地中找到该 `svg` 图标,否则,会加载 `Iconify` 图标。
 
 ```vue
@@ -25,7 +27,34 @@ Icon 组件位于 [src/components/Icon](https://github.com/kailong321200875/vue-
 
 ```
 
-## Icon 属性
+### useIcon
+
+如果需要在其他组件中如 `ElButton` 传入 `icon` 属性,可以使用 `useIcon`
+
+```vue
+<script setup lang="ts">
+import { useIcon } from '@/hooks/web/useIcon'
+import { ElButton } from 'element-plus'
+
+const icon = useIcon({ icon: 'svg-icon:save' })
+</script>
+
+<template>
+  <ElButton :icon="icon"> button </ElButton>
+</template>
+```
+
+#### 参数介绍
+
+```ts
+const icon = useIcon(props)
+```
+
+**props**
+
+[详见](#Icon)
+
+## Icon 属性<span id="Icon"></span>
 
 | 属性 | 说明 | 类型 | 可选值 | 默认值 |
 | ---- | ---- | ---- | ---- | ---- |

+ 2 - 0
components/image-viewer.md

@@ -2,6 +2,8 @@
 
 将 `element-plus` 的 `ImageViewer` 组件函数化,通过函数方便创建组件。
 
+ImageViewer 组件位于 [src/components/ImageViewer](https://github.com/kailong321200875/vue-element-plus-admin/tree/master/src/components/ImageViewer) 内
+
 ## 用法
 
 ```vue

+ 2 - 0
components/infotip.md

@@ -2,6 +2,8 @@
 
 基于 `Highlight` 组件封装。
 
+Infotip 组件位于 [src/components/Infotip](https://github.com/kailong321200875/vue-element-plus-admin/tree/master/src/components/Infotip) 内
+
 ## 用法
 
 ```vue

+ 2 - 0
components/qrcode.md

@@ -2,6 +2,8 @@
 
 基于 `qrcode` 封装。
 
+Qrcode 组件位于 [src/components/Qrcode](https://github.com/kailong321200875/vue-element-plus-admin/tree/master/src/components/Qrcode) 内
+
 ## 用法
 
 更复杂点的例子,请[在线预览](https://element-plus-admin.cn/#/components/qrcode)

+ 2 - 0
components/search.md

@@ -2,6 +2,8 @@
 
 基于 `Form` 组件封装,支持收缩展开。
 
+Search 组件位于 [src/components/Search](https://github.com/kailong321200875/vue-element-plus-admin/tree/master/src/components/Search) 内
+
 ## 用法
 
 更复杂例子,请[在线预览](https://element-plus-admin.cn/#/components/search)

+ 1 - 1
guide/auth.md

@@ -217,5 +217,5 @@ const redirectPath = from.query.redirect || to.path
 const redirect = decodeURIComponent(redirectPath as string)
 const nextData = to.path === redirect ? { ...to, replace: true } : { path: redirect }
 permissionStore.setIsAddRouters(true)
-next(to.path === '/' ? { path: permissionStore.addRouters[0]?.path as string } : nextData)
+next(nextData)
 ```

+ 5 - 6
guide/introduction.md

@@ -36,18 +36,16 @@
 ├── mock # 自定义 mock 数据及配置
 ├── public # 静态资源
 ├── src # 项目代码
+│   ├── api # api接口管理
 │   ├── assets # 静态资源
-│   ├── axios-config # axios配置
 │   ├── components # 公用组件
-│   ├── directive # 自定义指令
 │   ├── hooks # 常用hooks
 │   ├── layout # 布局组件
+│   ├── locales # 语言文件
 │   ├── plugins # 外部插件
-│   ├── mock # 模拟数据
 │   ├── router # 路由配置
 │   ├── store # 状态管理
 │   ├── styles # 全局样式
-│   ├── types # 全局类型
 │   ├── utils # 全局工具类
 │   ├── views # 路由页面
 │   ├── App.vue # 入口vue文件
@@ -56,6 +54,7 @@
 ├── types # 全局类型
 ├── .env.base # 本地开发环境 环境变量配置
 ├── .env.dev # 打包到开发环境 环境变量配置
+├── .env.gitee # 针对 gitee 的环境变量 可忽略
 ├── .env.pro # 打包到生产环境 环境变量配置
 ├── .env.test # 打包到测试环境 环境变量配置
 ├── .eslintignore # eslint 跳过检测配置
@@ -63,8 +62,8 @@
 ├── .gitignore # git 跳过配置
 ├── .prettierignore # prettier 跳过检测配置
 ├── .stylelintignore # stylelint 跳过检测配置
-├── CHANGELOG.en.md # 英文更新记录
-├── CHANGELOG.zh_CN.md # 中文更新记录
+├── .versionrc 自动生成版本号及更新记录配置
+├── CHANGELOG.md # 更新记录
 ├── commitlint.config.js # git commit 提交规范配置
 ├── index.html # 入口页面
 ├── package.json

+ 2 - 1
package.json

@@ -7,7 +7,8 @@
   "license": "MIT",
   "scripts": {
     "dev": "vitepress dev",
-    "build": "vitepress build",
+    "build:github": "vitepress build --github",
+    "build:gitee": "vitepress build --gitee",
     "serve": "vitepress serve"
   },
   "devDependencies": {