├── .editorconfig
├── .gitattributes
├── .gitignore
├── .npmrc
├── .vitepress
├── config.ts
├── icon.ts
├── locales
│ ├── jp.ts
│ └── zh.ts
└── theme
│ ├── index.ts
│ └── style.css
├── .vscode
├── extensions.json
├── launch.json
└── settings.json
├── CHANGELOG.md
├── LICENSE
├── README.md
├── eslint.config.js
├── package.json
├── pnpm-lock.yaml
├── pnpm-workspace.yaml
├── src
├── assets
│ ├── VSCode调试指南01.png
│ ├── VSCode调试指南02.png
│ ├── VSCode调试指南03.png
│ ├── loading01.png
│ └── router-guard-flow.png
├── awesome
│ └── index.md
├── faq
│ └── index.md
├── guide
│ ├── cli
│ │ ├── command.md
│ │ ├── git-hooks.md
│ │ └── intro.md
│ ├── hooks
│ │ └── use-table.md
│ ├── icon
│ │ ├── intro.md
│ │ └── usage.md
│ ├── intro.md
│ ├── quick-start.md
│ ├── request
│ │ ├── backend.md
│ │ ├── intro.md
│ │ ├── proxy.md
│ │ └── usage.md
│ ├── router
│ │ ├── cache.md
│ │ ├── component.md
│ │ ├── create.md
│ │ ├── dynamic.md
│ │ ├── guard.md
│ │ ├── intro.md
│ │ ├── push.md
│ │ └── structure.md
│ ├── sync.md
│ └── theme
│ │ ├── config.md
│ │ ├── intro.md
│ │ ├── loading.md
│ │ ├── logo.md
│ │ ├── tokens.md
│ │ ├── ui.md
│ │ └── unocss.md
├── index.md
├── jp
│ ├── awesome
│ │ └── index.md
│ ├── cooperate
│ │ └── index.md
│ ├── faq
│ │ └── index.md
│ ├── guide
│ │ ├── cli
│ │ │ ├── command.md
│ │ │ ├── git-hooks.md
│ │ │ └── intro.md
│ │ ├── hooks
│ │ │ └── use-table.md
│ │ ├── icon
│ │ │ ├── intro.md
│ │ │ └── usage.md
│ │ ├── intro.md
│ │ ├── quick-start.md
│ │ ├── request
│ │ │ ├── backend.md
│ │ │ ├── intro.md
│ │ │ ├── proxy.md
│ │ │ └── usage.md
│ │ ├── router
│ │ │ ├── cache.md
│ │ │ ├── component.md
│ │ │ ├── create.md
│ │ │ ├── dynamic.md
│ │ │ ├── guard.md
│ │ │ ├── intro.md
│ │ │ ├── push.md
│ │ │ └── structure.md
│ │ ├── sync.md
│ │ └── theme
│ │ │ ├── config.md
│ │ │ ├── intro.md
│ │ │ ├── loading.md
│ │ │ ├── logo.md
│ │ │ ├── tokens.md
│ │ │ ├── ui.md
│ │ │ └── unocss.md
│ ├── index.md
│ ├── other
│ │ └── donate.md
│ ├── recommend
│ │ ├── alova.md
│ │ ├── index.md
│ │ ├── klona.md
│ │ ├── page-spy.md
│ │ └── soybean-cli.md
│ ├── standard
│ │ ├── index.md
│ │ ├── lint.md
│ │ ├── naming.md
│ │ ├── synthesis.md
│ │ ├── tools.md
│ │ ├── ts.md
│ │ └── vue.md
│ └── tutorial
│ │ ├── debug.md
│ │ ├── git.md
│ │ ├── index.md
│ │ ├── nodejs.md
│ │ ├── other.md
│ │ └── software.md
├── other
│ └── donate.md
├── public
│ ├── favicon.ico
│ ├── logo.svg
│ ├── router-guard-flow.pdf
│ └── tencent-qq.svg
├── recommend
│ ├── alova.md
│ ├── index.md
│ ├── klona.md
│ ├── page-spy.md
│ └── soybean-cli.md
├── standard
│ ├── index.md
│ ├── lint.md
│ ├── naming.md
│ ├── synthesis.md
│ ├── tools.md
│ ├── ts.md
│ └── vue.md
├── tutorial
│ ├── debug.md
│ ├── git.md
│ ├── index.md
│ ├── nodejs.md
│ ├── other.md
│ └── software.md
└── zh
│ ├── awesome
│ └── index.md
│ ├── cooperate
│ └── index.md
│ ├── faq
│ └── index.md
│ ├── guide
│ ├── cli
│ │ ├── command.md
│ │ ├── git-hooks.md
│ │ └── intro.md
│ ├── hooks
│ │ └── use-table.md
│ ├── icon
│ │ ├── intro.md
│ │ └── usage.md
│ ├── intro.md
│ ├── quick-start.md
│ ├── request
│ │ ├── backend.md
│ │ ├── intro.md
│ │ ├── proxy.md
│ │ └── usage.md
│ ├── router
│ │ ├── cache.md
│ │ ├── component.md
│ │ ├── create.md
│ │ ├── dynamic.md
│ │ ├── guard.md
│ │ ├── intro.md
│ │ ├── push.md
│ │ └── structure.md
│ ├── sync.md
│ └── theme
│ │ ├── config.md
│ │ ├── intro.md
│ │ ├── loading.md
│ │ ├── logo.md
│ │ ├── tokens.md
│ │ ├── ui.md
│ │ └── unocss.md
│ ├── index.md
│ ├── other
│ └── donate.md
│ ├── recommend
│ ├── alova.md
│ ├── index.md
│ ├── klona.md
│ ├── page-spy.md
│ └── soybean-cli.md
│ ├── standard
│ ├── index.md
│ ├── lint.md
│ ├── naming.md
│ ├── synthesis.md
│ ├── tools.md
│ ├── ts.md
│ └── vue.md
│ └── tutorial
│ ├── debug.md
│ ├── git.md
│ ├── index.md
│ ├── nodejs.md
│ ├── other.md
│ └── software.md
└── tsconfig.json
/.editorconfig:
--------------------------------------------------------------------------------
1 | # Editor configuration, see http://editorconfig.org
2 |
3 | root = true
4 |
5 | [*]
6 | charset = utf-8
7 | indent_style = space
8 | indent_size = 2
9 | end_of_line = lf
10 | trim_trailing_whitespace = true
11 | insert_final_newline = true
12 |
--------------------------------------------------------------------------------
/.gitattributes:
--------------------------------------------------------------------------------
1 | "*.vue" eol=lf
2 | "*.js" eol=lf
3 | "*.ts" eol=lf
4 | "*.jsx" eol=lf
5 | "*.tsx" eol=lf
6 | "*.cjs" eol=lf
7 | "*.cts" eol=lf
8 | "*.mjs" eol=lf
9 | "*.mts" eol=lf
10 | "*.json" eol=lf
11 | "*.html" eol=lf
12 | "*.css" eol=lf
13 | "*.less" eol=lf
14 | "*.scss" eol=lf
15 | "*.sass" eol=lf
16 | "*.styl" eol=lf
17 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Logs
2 | logs
3 | *.log
4 | npm-debug.log*
5 | yarn-debug.log*
6 | yarn-error.log*
7 | pnpm-debug.log*
8 | lerna-debug.log*
9 |
10 | node_modules
11 | .DS_Store
12 | dist
13 | dist-ssr
14 | coverage
15 | *.local
16 |
17 | /cypress/videos/
18 | /cypress/screenshots/
19 |
20 | # Editor directories and files
21 | .vscode/*
22 | !.vscode/extensions.json
23 | !.vscode/settings.json
24 | !.vscode/launch.json
25 | .idea
26 | *.suo
27 | *.ntvs*
28 | *.njsproj
29 | *.sln
30 | *.sw?
31 |
32 | package-lock.json
33 | yarn.lock
34 |
35 | .VSCodeCounter
36 | **/.vitepress/cache
37 |
--------------------------------------------------------------------------------
/.npmrc:
--------------------------------------------------------------------------------
1 | registry=https://registry.npmmirror.com/
2 | shamefully-hoist=true
3 | ignore-workspace-root-check=true
--------------------------------------------------------------------------------
/.vitepress/icon.ts:
--------------------------------------------------------------------------------
1 | export const qqSvg = `
2 |
32 | `;
33 |
--------------------------------------------------------------------------------
/.vitepress/theme/index.ts:
--------------------------------------------------------------------------------
1 | import Theme from 'vitepress/theme';
2 | import './style.css';
3 |
4 | export default Theme;
5 |
--------------------------------------------------------------------------------
/.vitepress/theme/style.css:
--------------------------------------------------------------------------------
1 | /**
2 | * Customize default theme styling by overriding CSS variables:
3 | * https://github.com/vuejs/vitepress/blob/main/src/client/theme-default/styles/vars.css
4 | */
5 |
6 | /**
7 | * Colors
8 | * -------------------------------------------------------------------------- */
9 |
10 | :root {
11 | --vp-c-brand: #646cff;
12 | --vp-c-brand-light: #747bff;
13 | --vp-c-brand-lighter: #9499ff;
14 | --vp-c-brand-lightest: #bcc0ff;
15 | --vp-c-brand-dark: #535bf2;
16 | --vp-c-brand-darker: #454ce1;
17 | --vp-c-brand-dimm: rgba(100, 108, 255, 0.08);
18 | }
19 |
20 | /**
21 | * Component: Button
22 | * -------------------------------------------------------------------------- */
23 |
24 | :root {
25 | --vp-button-brand-border: var(--vp-c-brand-light);
26 | --vp-button-brand-text: var(--vp-c-white);
27 | --vp-button-brand-bg: var(--vp-c-brand);
28 | --vp-button-brand-hover-border: var(--vp-c-brand-light);
29 | --vp-button-brand-hover-text: var(--vp-c-white);
30 | --vp-button-brand-hover-bg: var(--vp-c-brand-light);
31 | --vp-button-brand-active-border: var(--vp-c-brand-light);
32 | --vp-button-brand-active-text: var(--vp-c-white);
33 | --vp-button-brand-active-bg: var(--vp-button-brand-bg);
34 | }
35 |
36 | /**
37 | * Component: Home
38 | * -------------------------------------------------------------------------- */
39 |
40 | :root {
41 | --vp-home-hero-name-color: transparent;
42 | --vp-home-hero-name-background: -webkit-linear-gradient(
43 | 120deg,
44 | var(--vp-c-brand-lightest) 30%,
45 | var(--vp-c-brand-darker)
46 | );
47 |
48 | --vp-home-hero-image-background-image: linear-gradient(-45deg, var(--vp-c-brand-lightest) 30%, var(--vp-c-brand) 50%);
49 | --vp-home-hero-image-filter: blur(40px);
50 | }
51 |
52 | @media (min-width: 640px) {
53 | :root {
54 | --vp-home-hero-image-filter: blur(56px);
55 | }
56 | }
57 |
58 | @media (min-width: 960px) {
59 | :root {
60 | --vp-home-hero-image-filter: blur(72px);
61 | }
62 | }
63 |
64 | /**
65 | * Component: Custom Block
66 | * -------------------------------------------------------------------------- */
67 |
68 | :root {
69 | --vp-custom-block-tip-border: var(--vp-c-brand);
70 | --vp-custom-block-tip-text: var(--vp-c-brand-darker);
71 | --vp-custom-block-tip-bg: var(--vp-c-brand-dimm);
72 | }
73 |
74 | .dark {
75 | --vp-custom-block-tip-border: var(--vp-c-brand);
76 | --vp-custom-block-tip-text: var(--vp-c-brand-lightest);
77 | --vp-custom-block-tip-bg: var(--vp-c-brand-dimm);
78 | }
79 |
80 | /**
81 | * Component: Algolia
82 | * -------------------------------------------------------------------------- */
83 |
84 | .DocSearch {
85 | --docsearch-primary-color: var(--vp-c-brand) !important;
86 | }
87 |
88 | /**
89 | * Version Badge
90 | * -------------------------------------------------------------------------- */
91 |
92 | .vt-badge {
93 | display: inline-block;
94 | border-radius: 6px;
95 | font-size: 0.65em;
96 | line-height: 1;
97 | font-weight: 600;
98 | letter-spacing: 2px;
99 | padding: 0.35em 0.4em 0.3em;
100 | position: relative;
101 | top: -0.65em;
102 | margin-left: 0.5em;
103 | color: #ffffff;
104 | transition: color 0.5s;
105 | background-color: var(--vp-c-brand);
106 | }
107 |
--------------------------------------------------------------------------------
/.vscode/extensions.json:
--------------------------------------------------------------------------------
1 | {
2 | "recommendations": [
3 | "antfu.unocss",
4 | "dbaeumer.vscode-eslint",
5 | "editorconfig.editorconfig",
6 | "esbenp.prettier-vscode",
7 | "kisstkondoros.vscode-gutter-preview",
8 | "mariusalchimavicius.json-to-ts",
9 | "mhutchie.git-graph",
10 | "sdras.vue-vscode-snippets",
11 | "vue.volar"
12 | ]
13 | }
14 |
--------------------------------------------------------------------------------
/.vscode/launch.json:
--------------------------------------------------------------------------------
1 | {
2 | "version": "0.2.0",
3 | "configurations": [
4 | {
5 | "type": "chrome",
6 | "request": "launch",
7 | "name": "Vue debugger",
8 | "url": "http://localhost:9527",
9 | "webRoot": "${workspaceFolder}"
10 | },
11 | {
12 | "type": "node",
13 | "request": "launch",
14 | "name": "TS debugger",
15 | "skipFiles": ["/**"],
16 | "runtimeArgs": ["--loader", "tsx"],
17 | "program": "${relativeFile}"
18 | }
19 | ]
20 | }
21 |
--------------------------------------------------------------------------------
/.vscode/settings.json:
--------------------------------------------------------------------------------
1 | {
2 | "editor.codeActionsOnSave": {
3 | "source.fixAll.eslint": "explicit",
4 | "source.organizeImports": "never"
5 | },
6 | "eslint.experimental.useFlatConfig": true,
7 | "editor.formatOnSave": false,
8 | "eslint.validate": ["html", "css", "scss", "json", "jsonc"],
9 | "prettier.enable": false,
10 | "unocss.root": ["./"]
11 | }
12 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2021 Soybean
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # SoybeanAdmin Documentation
2 |
3 | [](https://github.com/soybeanjs/soybean-admin-docs)
4 | [](https://github.com/soybeanjs/soybean-admin-docs)
5 | [](https://gitee.com/honghuangdc/soybean-admin-docs)
6 | [](https://gitcode.com/soybeanjs/soybean-admin-docs)
7 |
8 | ## 简介
9 |
10 | 这是 [SoybeanAdmin](https://github.com/honghuangdc/soybean-admin) 项目的官方文档。本文档使用 [VitePress](https://vitepress.dev/) 构建,提供多语言支持(中文和日语)。
11 |
12 | ## SoybeanAdmin 仓库
13 |
14 | - **NaiveUI 版本:**
15 | - [预览地址](https://naive.soybeanjs.cn/)
16 | - [Github 仓库](https://github.com/soybeanjs/soybean-admin)
17 | - [Gitee 仓库](https://gitee.com/honghuangdc/soybean-admin)
18 | - [Gitcode 仓库](https://gitcode.com/soybeanjs/soybean-admin)
19 | - **AntDesignVue 版本:**
20 | - [预览地址](https://antd.soybeanjs.cn/)
21 | - [Github 仓库](https://github.com/soybeanjs/soybean-admin-antd)
22 | - [Gitee 仓库](https://gitee.com/honghuangdc/soybean-admin-antd)
23 | - [Gitcode 仓库](https://gitcode.com/soybeanjs/soybean-admin-antd)
24 | - **ElementPlus 版本:**
25 | - [预览地址](https://elp.soybeanjs.cn/)
26 | - [Github 仓库](https://github.com/soybeanjs/soybean-admin-element-plus)
27 | - [Gitee 仓库](https://gitee.com/honghuangdc/soybean-admin-element-plus)
28 | - [Gitcode 仓库](https://gitcode.com/soybeanjs/soybean-admin-element-plus)
29 | - **旧版:**
30 |
31 | - [预览地址](https://legacy.soybeanjs.cn/)
32 | - [Github 仓库](https://github.com/soybeanjs/soybean-admin/tree/legacy)
33 | - [Gitee 仓库](https://gitee.com/honghuangdc/soybean-admin/tree/legacy)
34 | - [Gitcode 仓库](https://gitcode.com/soybeanjs/soybean-admin/tree/legacy)
35 |
36 | - **文档仓库:**
37 | - [Github 仓库](https://github.com/soybeanjs/soybean-admin-docs)
38 | - [Gitee 仓库](https://gitee.com/honghuangdc/soybean-admin-docs)
39 | - [Gitcode 仓库](https://gitcode.com/soybeanjs/soybean-admin-docs)
40 |
41 | ## 克隆
42 |
43 | ```bash
44 | # github
45 | git clone https://github.com/soybeanjs/soybean-admin-docs.git
46 | # gitee
47 | git clone https://gitee.com/honghuangdc/soybean-admin-docs.git
48 | # gitcode
49 | git clone https://gitcode.com/soybeanjs/soybean-admin-docs.git
50 | ```
51 |
52 | ## 安装
53 |
54 | ```bash
55 | # 安装依赖
56 | pnpm install
57 | ```
58 |
59 | ## 开发
60 |
61 | ```bash
62 | # 启动开发服务器
63 | pnpm dev
64 | ```
65 |
66 | ## 构建
67 |
68 | ```bash
69 | # 构建文档
70 | pnpm build
71 | ```
72 |
73 | ## 预览构建结果
74 |
75 | ```bash
76 | # 预览构建后的文档
77 | pnpm preview
78 | ```
79 |
80 | ## 项目结构
81 |
82 | - [`.vitepress`](.vitepress) - VitePress 配置和主题文件
83 | - `config.ts` - 主要配置文件
84 | - `locales/` - 多语言支持文件
85 | - [`src`](src) - 文档内容
86 | - `zh/` - 中文文档
87 | - `jp/` - 日语文档
88 | - `guide/` - 指南
89 | - `tutorial/` - 教程
90 | - `awesome/` - 精选资源
91 | - `standard/` - 规范
92 | - `faq/` - 常见问题
93 | - `recommend/` - 推荐内容
94 |
95 | ## 贡献指南
96 |
97 | 欢迎为 SoybeanAdmin 文档做出贡献,请参考以下步骤:
98 |
99 | 1. Fork 本仓库
100 | 2. 创建您的特性分支 (`git checkout -b feature/amazing-feature`)
101 | 3. 提交您的更改 (`git commit -m 'Add some amazing feature'`)
102 | 4. 推送到分支 (`git push origin feature/amazing-feature`)
103 | 5. 打开一个 Pull Request
104 |
105 | ## 许可证
106 |
107 | 本项目使用 MIT 许可证 进行许可。
108 |
--------------------------------------------------------------------------------
/eslint.config.js:
--------------------------------------------------------------------------------
1 | import { defineConfig } from '@soybeanjs/eslint-config';
2 |
3 | export default defineConfig({
4 | formatter: {
5 | markdown: true
6 | }
7 | });
8 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "soybean-admin-docs",
3 | "type": "module",
4 | "version": "1.0.0",
5 | "description": "The documentation of SoybeanAdmin",
6 | "author": {
7 | "name": "Soybean",
8 | "email": "soybeanjs@outlook.com",
9 | "url": "https://github.com/soybeanjs"
10 | },
11 | "license": "MIT",
12 | "homepage": "https://github.com/soybeanjs/soybean-admin-docs",
13 | "repository": {
14 | "url": "https://github.com/soybeanjs/soybean-admin-docs.git"
15 | },
16 | "bugs": {
17 | "url": "https://github.com/soybeanjs/soybean-admin-docs/issues"
18 | },
19 | "engines": {
20 | "node": ">=18.12.0",
21 | "pnpm": ">=8.7.0"
22 | },
23 | "scripts": {
24 | "build": "vitepress build",
25 | "cleanup": "soy cleanup",
26 | "commit": "soy git-commit",
27 | "commit:zh": "soy git-commit -l=zh-cn",
28 | "dev": "vitepress dev --port 1026",
29 | "lint": "eslint . --fix",
30 | "preview": "vitepress serve",
31 | "release": "soy release",
32 | "typecheck": "vue-tsc --noEmit --skipLibCheck",
33 | "update-pkg": "soy ncu"
34 | },
35 | "devDependencies": {
36 | "@soybeanjs/cli": "1.3.0",
37 | "@soybeanjs/eslint-config": "1.6.1",
38 | "@types/node": "22.15.19",
39 | "eslint": "9.27.0",
40 | "typescript": "5.8.3",
41 | "vitepress": "1.6.3"
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/pnpm-workspace.yaml:
--------------------------------------------------------------------------------
1 | onlyBuiltDependencies:
2 | - unrs-resolver
3 |
--------------------------------------------------------------------------------
/src/assets/VSCode调试指南01.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/soybeanjs/soybean-admin-docs/de47ce6a2600a0422e0992fc27188b5c36d0dade/src/assets/VSCode调试指南01.png
--------------------------------------------------------------------------------
/src/assets/VSCode调试指南02.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/soybeanjs/soybean-admin-docs/de47ce6a2600a0422e0992fc27188b5c36d0dade/src/assets/VSCode调试指南02.png
--------------------------------------------------------------------------------
/src/assets/VSCode调试指南03.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/soybeanjs/soybean-admin-docs/de47ce6a2600a0422e0992fc27188b5c36d0dade/src/assets/VSCode调试指南03.png
--------------------------------------------------------------------------------
/src/assets/loading01.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/soybeanjs/soybean-admin-docs/de47ce6a2600a0422e0992fc27188b5c36d0dade/src/assets/loading01.png
--------------------------------------------------------------------------------
/src/assets/router-guard-flow.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/soybeanjs/soybean-admin-docs/de47ce6a2600a0422e0992fc27188b5c36d0dade/src/assets/router-guard-flow.png
--------------------------------------------------------------------------------
/src/guide/cli/command.md:
--------------------------------------------------------------------------------
1 | # Command Line
2 |
3 | ## Overview
4 |
5 | The `sa` command line tool in the project provides some commonly used functions
6 |
7 | - `cleanup`: Delete directories: node_modules, dist, etc.
8 | - `update-pkg`: Update package.json dependency versions
9 | - `git-commit`: Generate commit messages that comply with the Conventional Commits standard
10 | - `git-commit-verify`: Verify git commit messages to ensure compliance with the Conventional Commits standard
11 | - `changelog`: Generate changelog
12 | - `release`: Release, update version, generate changelog, commit code
13 | - `gen-route`: Generate routes
14 |
15 | > The `sa` command is provided by `packages/scripts`
16 |
--------------------------------------------------------------------------------
/src/guide/cli/git-hooks.md:
--------------------------------------------------------------------------------
1 | # Git Hooks
2 |
3 | ::: tip
4 | This document was generated by machine translation. If there are any errors, please inform us
5 | :::
6 |
7 | ## Write in the front
8 |
9 | > Most code written in JS is used to using the runtime to determine if there is a problem with the code or not.
10 | >
11 | > For example, using JS development to interface with the back-end is such a process, when the interface is good, tune the interface, get the data, and then figure out how to stuff the data into the page inside the
12 | >
13 | > If it's a very simple page, this process seems to be fine. But for a slightly more complex one, the code written through this process would be the foundation of a mountain of shit, making it extremely headache-inducing to troubleshoot various issues in the later stage.
14 |
15 | TypeScript is a great tool to write high-quality code, the process of defining data types is the process of defining the front-end data model, once the data model has been determined, the data model of the various operations can be achieved using pure functions, and then the data combined with the responsive, you only need to introduce the corresponding pure functions to do a simple secondary packaging can be, most people do not adapt to the TS Most people are not comfortable with the type of TS, mainly because they haven't switched to the development mode. You can try to use this mode for a few sections to experience the charm of TypeScript, and then decide whether or not to remove the `git-hooks`.
16 |
17 | Using `git-hooks` for pre-commit checksums not only helps you improve your own code, but also reduces the cost of maintaining your project, and helps you take over other people's code. The few downsides to all of this are the small amount of time it takes to learn (SoybeanAdmin's project has 100% type coverage, which is best practice and the best time to get started with TypeScript) and get used to it, so you can try it out for a while (feel free to discuss this with the community) before deciding to remove it. You can try it out for a while (feel free to discuss it with us in the community) before deciding whether to remove `git-hooks`.
18 |
19 | ## Remove git-hooks
20 |
21 | ::: details Option 1: Temporary closure of checksums
22 | It is recommended to follow the well-established type checks as fully as possible initially, only skipping them slightly a few times by temporarily cancelling the submission checks when needed.
23 |
24 | ```shell
25 | git add .
26 |
27 | git commit -m "commit message" # [!code --]
28 | git commit -m "commit message" --no-verify # [!code ++]
29 |
30 | git push
31 | ```
32 |
33 | :::
34 |
35 | ::: details Option 2: Permanently disable checksums
36 |
37 | > [!CAUTION] not recommended
38 | > 1、Remove the commands from `simple-git-hooks` in `package.json
39 | >
40 | > 2、Execute the `simple-git-hooks` command.
41 | >
42 | > :::
43 |
--------------------------------------------------------------------------------
/src/guide/cli/intro.md:
--------------------------------------------------------------------------------
1 | # Commands
2 |
3 | ## cleanup
4 |
5 | Delete directories: node_modules, dist, etc.
6 |
7 | ```bash
8 | sa cleanup
9 | ```
10 |
11 | ## update-pkg
12 |
13 | Update package.json dependency versions
14 |
15 | ```bash
16 | sa update-pkg
17 | ```
18 |
19 | ## git-commit
20 |
21 | Generate commit messages that conform to the Conventional Commits standard
22 |
23 | ```bash
24 | sa git-commit
25 | ```
26 |
27 | ## git-commit-verify
28 |
29 | Verify git commit messages to ensure they conform to the Conventional Commits standard
30 |
31 | ```bash
32 | sa git-commit-verify
33 | ```
34 |
35 | ## changelog
36 |
37 | Generate changelog
38 |
39 | ```bash
40 | sa changelog
41 | ```
42 |
43 | ## release
44 |
45 | Release, update version, generate changelog, commit code
46 |
47 | ```bash
48 | sa release
49 | ```
50 |
51 | ## gen-route
52 |
53 | Generate routes
54 |
55 | ```bash
56 | sa gen-route
57 | ```
58 |
--------------------------------------------------------------------------------
/src/guide/icon/intro.md:
--------------------------------------------------------------------------------
1 | # System Icons
2 |
3 | ## Icon Rendering Principle
4 |
5 | Based on the svg json data of iconify, the svg data is converted into vue components through the unplugin-icons plugin.
6 |
7 | - [unplugin-icons](https://github.com/antfu/unplugin-icons)
8 | - [iconify](https://github.com/iconify/iconify)
9 | - [Journey with Icons Continues](https://antfu.me/posts/journey-with-icons-continues)
10 |
11 | ## Local svg icon rendering principle
12 |
13 | By using the `unplugin-icons` plugin and `vite-plugin-svg-icons` plugin, local svg files are converted into vue components
14 |
15 | > Local svg icons need to be placed in the src/assets/svg-icon directory
16 |
17 | ## Related configuration
18 |
19 | **.env configuration file**
20 |
21 | - VITE_ICON_PREFIX: iconify icon prefix
22 | - VITE_ICON_LOCAL_PREFIX: local svg icon prefix, the format follows {VITE_ICON_PREFIX}-{local icon name}
23 |
24 | ## Note
25 |
26 | Based on the rendering mechanism of svg icons, once the svg files are loaded and transformed into components, they become a part of your project and will not automatically detect and update any changes made to the source files. Therefore, if you modify an svg file and want to see the changes in your project, you need to restart the project.
27 |
--------------------------------------------------------------------------------
/src/guide/icon/usage.md:
--------------------------------------------------------------------------------
1 | # Icon Tutorial
2 |
3 | ## I. Static Usage: Directly written in the template
4 |
5 | - **iconify**
6 |
7 | - Install the vscode smart prompt plugin: [Iconify IntelliSense](https://marketplace.visualstudio.com/items?itemName=antfu.iconify)
8 |
9 | - Find the icon: URL [https://icones.js.org/](https://icones.js.org/) or install vscode - [Icônes](https://marketplace.visualstudio.com/items?itemName=afzalsayed96.icones)
10 |
11 | - Determine the icon name: After finding the icon, copy the name such as: 'mdi:emoticon' or 'mdi-emoticon', the corresponding vue template is
12 |
13 | ```html
14 |
15 |
16 |
17 |
18 | ```
19 |
20 | ::: tip Tip
21 | 'icon-' is a preset prefix, set the variable VITE_ICON_PREFIX in .env
22 | :::
23 |
24 | - Set the style: Apply the style attribute or class attribute directly like the html tag; set the corresponding color and size by setting the color and font-size attributes
25 |
26 | - **Local svg icon**
27 |
28 | - Choose an svg in the src/assets/svg-icon directory, take its filename, for example: 'custom-icon.svg'
29 |
30 | - The corresponding vue template is
31 |
32 | ```html
33 |
34 | ```
35 |
36 | ::: tip Tip
37 | 'icon-local' is a preset prefix, set the variable VITE_ICON_LOCAL_PREFIX in .env
38 | :::
39 |
40 | ## II. Dynamic Rendering: Render corresponding icon based on the icon name
41 |
42 | - **iconify**
43 |
44 | - Determine the icon name, such as: 'mdi-emoticon'
45 |
46 | - Dynamic rendering
47 |
48 | ```html
49 |
50 | ```
51 |
52 | - Dynamic rendering of multiple icons
53 |
54 | ```html
55 |
56 | ```
57 |
58 | - **Local svg icons**
59 |
60 | - Determine the svg file name, for example: 'custom-icon.svg'
61 |
62 | - Dynamic rendering
63 |
64 | ```html
65 |
66 | ```
67 |
68 | ::: tip Tip
69 | svg-icon is a global component that has been registered, directly applied in the template, the icon attribute is the iconify icon name, and local-icon is the file name of the local svg icon
70 | :::
71 |
72 | ## III. Rendering through the render function: Suitable for NaiveUI icon rendering
73 |
74 | - Determine the icon name, such as: iconify: **'mdi-emoticon'**, or local svg icon 'custom-icon.svg'
75 |
76 | - Use **useSvgIconRender**
77 |
78 | ::: tip Code location
79 | packages/hooks/src/use-svg-icon-render.ts
80 | :::
81 |
82 | ```typescript
83 | import { useSvgIconRender } from '@sa/hooks';
84 | import SvgIcon from '@/components/custom/svg-icon.vue';
85 |
86 | const { SvgIconVNode } = useSvgIconRender(SvgIcon);
87 |
88 | SvgIconVNode({ icon: 'ant-design:close-outlined', fontSize: 18 }); // iconify
89 |
90 | SvgIconVNode({ localIcon: 'custom-icon' }); // Local svg icon
91 | ```
92 |
93 | ## IV. Offline Loading: Adding Specified Offline Iconify Icon Collections
94 |
95 | - **Usage Steps**
96 |
97 | - Install dependencies
98 |
99 | ```bash
100 | ## Include icon component data
101 | pnpm add @iconify/vue
102 |
103 | ## Include offline icon data
104 | pnpm add @iconify/json
105 | ```
106 |
107 | ::: tip Tip
108 | The project has already imported the relevant dependencies, so you can directly reference them in the component.
109 | :::
110 |
111 | - Prepare offline icon collection data
112 |
113 | For example, if we need to use the `Ant Design` icon library in our project, we can introduce offline icons as follows
114 |
115 | ```typescript
116 | import AntDesign from '@iconify/json/json/ant-design.json';
117 | ```
118 |
119 | - Use the `addCollection` method to add offline icons in the page
120 |
121 | ```typescript
122 | import { addCollection } from '@iconify/vue';
123 | ```
124 |
125 | - **Code Example**
126 |
127 | ```vue
128 |
134 |
135 |
136 |
137 |
138 | ```
139 |
--------------------------------------------------------------------------------
/src/guide/request/backend.md:
--------------------------------------------------------------------------------
1 | # Backend Integration
2 |
3 | ## Confirm the data structure type of the backend return result
4 |
5 | The default is as follows:
6 |
7 | `App.Service.Response`:
8 |
9 | ```ts
10 | type Response = {
11 | /** Business status code */
12 | code: string;
13 | /** Response message */
14 | msg: string;
15 | /** Response data */
16 | data: T;
17 | };
18 | ```
19 |
20 | > Please modify according to the data type returned by your own backend
21 |
22 | ## Configure the success code of backend request
23 |
24 | Change the configuration `VITE_SERVICE_SUCCESS_CODE` in `.env`
25 |
26 | > The configuration loaded by the environment file is of string type. If the code returned by the backend is of numeric type, it needs to be converted to the same type for comparison.
27 |
28 | ## Configure other codes related to backend requests
29 |
30 | Refer to the [configuration items](./intro.md#request-related-configuration-introduction) in the request introduction
31 |
--------------------------------------------------------------------------------
/src/guide/request/intro.md:
--------------------------------------------------------------------------------
1 | # Request
2 |
3 | ## Multiple Request Environments
4 |
5 | Development projects often use multiple request environment addresses: such as the backend address for the user development environment, the backend address for the test environment, the backend address for the pre-production environment, and the address for the production environment, etc.
6 |
7 | Configure multiple request addresses in the environment file, and then determine which request address to use in the request function based on the environment variable.
8 |
9 | The current project's environment files are
10 |
11 | `.env.prod`, `.env.test`
12 |
13 | ## Introduction to Request Related Configuration
14 |
15 | Configuration items in the `.env` file
16 |
17 | - `VITE_SERVICE_SUCCESS_CODE`: The code for successful backend requests
18 | - `VITE_SERVICE_LOGOUT_CODES`: The code for backend request failures that require the user to log out, multiple codes are separated by `,`
19 | - `VITE_SERVICE_MODAL_LOGOUT_CODES`: The code for backend request failures that require the user to log out (reminded by popup), multiple codes are separated by `,`
20 | - `VITE_SERVICE_EXPIRED_TOKEN_CODES`: The code for backend request failures and refresh token, multiple codes are separated by `,`
21 |
22 | Configuration items in the `.env.test` or `.env.prod` file
23 |
24 | - `VITE_SERVICE_BASE_URL`: The base address for requests
25 | - `VITE_OTHER_SERVICE_BASE_URL`: The base address for other requests
26 |
27 | ### Introduction to Request Functions
28 |
29 | 1. **Request functions: createRequest and createFlatRequest**
30 |
31 | `createRequest`: The returned request instance directly returns Axios response data (convertible)
32 |
33 | `createFlatRequest`: The returned request instance will wrap the response data and error information in a flat object, and return the result in a unified format.
34 |
35 | 2. **Parameters for createRequest/createFlatRequest**
36 |
37 | `axiosConfig`: axios configuration, input baseUrl, define some other configurations: such as: request timeout, request header, etc.
38 |
39 | `options`: Configure input validation and other logic (see `RequestOption` below)
40 |
41 | ```ts
42 | interface RequestOption {
43 | /**
44 | * Execute before sending the request to modify the request configuration, for example: add request header token
45 | */
46 | onRequest: (config: InternalAxiosRequestConfig) => InternalAxiosRequestConfig | Promise;
47 | /**
48 | * Determine whether the backend response is successful by comparing the code returned by the backend
49 | */
50 | isBackendSuccess: (response: AxiosResponse) => boolean;
51 | /**
52 | * The asynchronous function called when the backend request indicates failure in business, for example: handle token expiration
53 | */
54 | onBackendFail: (
55 | response: AxiosResponse,
56 | instance: AxiosInstance
57 | ) => Promise | Promise;
58 | /**
59 | * When responseType is json, convert the backend response data
60 | */
61 | transformBackendResponse(response: AxiosResponse): any | Promise;
62 | /**
63 | * The function called when the request fails (including request failure and backend business failure request), for example: handle error information
64 | */
65 | onError: (error: AxiosError) => void | Promise;
66 | }
67 | ```
68 |
--------------------------------------------------------------------------------
/src/guide/request/proxy.md:
--------------------------------------------------------------------------------
1 | # Proxy
2 |
3 | ## Outlined
4 |
5 | The project creates the base path of the service and a string to match the proxy through the `createServiceConfig` function.
6 |
7 | ::: tip Code Location
8 | @/utils/service.ts
9 | :::
10 |
11 | The proxy is then created in the `createViteProxy` function based on the configuration obtained above.
12 |
13 | ## Enable/disable
14 |
15 | Enable or disable proxies via `VITE_HTTP_PROXY` in the `env` file.
16 |
17 | ::: tip Code Location
18 | ~.env
19 | :::
20 |
21 | In `@/service/request/index.ts`, you decide whether the URL needs to handle proxies by passing `isHttpProxy` to the second parameter of `getServiceBaseURL`, which is determined based on the environment in which the code is running in conjunction with `VITE_HTTP_PROXY`. You can deconstruct the request URL here by passing different parameters.
22 |
23 | ```
24 | const isHttpProxy = import.meta.env.DEV && import.meta.env.VITE_HTTP_PROXY === 'Y';
25 | const { baseURL } = getServiceBaseURL(import.meta.env, isHttpProxy);
26 | const { otherBaseURL } = getServiceBaseURL(import.meta.env, false);
27 | ```
28 |
29 | ## Principle
30 |
31 | SoybeanAdmin simplifies the process of configuring proxies by setting the matching string to `/proxy-default/` (other requests use `proxy-{key}`). This way, when configuring the proxy, you only need to replace `/proxy-default/` in the request address with the actual request address, thus achieving the proxy configuration.
32 |
33 | ```ts
34 | {
35 | '/proxy-default': {
36 | target: 'https://default.com',
37 | changeOrigin: true,
38 | rewrite: (path) => path.replace(/^\/proxy-default/, ''),
39 | },
40 | '/proxy-demo': {
41 | target: 'https://demo.com',
42 | changeOrigin: true,
43 | rewrite: (path) => path.replace(/^\/proxy-demo/, ''),
44 | }
45 | }
46 | ```
47 |
48 | ### Note
49 |
50 | Here are 2 configurations that are easily confused:
51 |
52 | 1. Suppose the path of a request is `https://example.com/api/user`, most would configure the proxy like this:
53 |
54 | ```ts
55 |
56 | {
57 | '/api': {
58 | target: 'https://example.com',
59 | changeOrigin: true,
60 | }
61 | }
62 |
63 | ```
64 |
65 | > In this case, `/api` serves both as the matching string and the request path. Therefore, there is no rewrite configuration needed because the request path and the matching string are the same.
66 |
67 | 2. Suppose the path of a request is `https://example.com/user`, but the matching string for the proxy configuration is `/api`
68 |
69 | ```ts
70 | {
71 | '/api': {
72 | target: 'https://example.com',
73 | changeOrigin: true,
74 | rewrite: (path) => path.replace(/^\/api/, ''),
75 | }
76 | }
77 | ```
78 |
79 | > In this case, `/api` serves as the matching string, and user serves as the request path. Therefore, a rewrite configuration is needed to remove the matching string.
80 |
81 | In SoybeanAdmin, the second configuration with `rewrite` is used. This is to support proxies for multiple services and avoid conflicts where multiple services contain the same `/api` path. Therefore, SoybeanAdmin chooses to create matching strings like `/proxy-*` to separate the matching string from the request path, avoiding conflicts.
82 |
--------------------------------------------------------------------------------
/src/guide/router/cache.md:
--------------------------------------------------------------------------------
1 | # Route Caching
2 |
3 | ## Principle
4 |
5 | Route caching is implemented through the `keep-alive` component of `vue-router`. The `keep-alive` component caches the state of the component. When the component is visited again, it will directly take the component from the cache, instead of creating a new component.
6 | Since the `keep-alive` component uses the `name` attribute of the component as the key for caching, the page components in the project have been automatically injected with the `name` attribute through the `@elegant-router/vue` plugin, so you only need to set the `keepAlive` field of the `meta` attribute in the route data.
7 | The multi-level route caching of `vue-router` has problems, so the route data in the project has been converted into two-level routes to ensure that each route can be cached normally.
8 |
9 |
10 | ## Usage
11 |
12 | By setting the `keepAlive` field in the `meta` attribute of the route data, you can control whether the route is cached.
13 |
14 | ```js
15 | {
16 | name: 'about',
17 | path: '/about',
18 | component: 'layout.base$view.about',
19 | meta: {
20 | title: 'about',
21 | keepAlive: true
22 | }
23 | }
24 | ```
25 |
--------------------------------------------------------------------------------
/src/guide/router/component.md:
--------------------------------------------------------------------------------
1 | # Routing component
2 |
3 | ## Layout components
4 |
5 | - **layout.base**: Layout with common parts, such as global header, sidebar, footer, etc.
6 |
7 | - **layout.blank**: Blank layout
8 |
9 | ## Page components
10 |
11 | - **view.[RouteKey]**: Page components
12 | > For example: `view.home`, `view.multi-menu_first_child`
13 |
14 | ## Mixed components of layout and page
15 |
16 | - **layout.base$view.[RouteKey]**: Mixed components of layout and page
17 | > For example: `layout.base$view.home`, `layout.base$view.multi-menu_first_child`
18 |
19 | ::: tip Tip
20 | This type of component represents a single-level route
21 | :::
22 |
--------------------------------------------------------------------------------
/src/guide/router/create.md:
--------------------------------------------------------------------------------
1 | # Route Creation
2 |
3 | ## Command Creation
4 |
5 | By executing the `pnpm gen-route` command, you can quickly create route files.
6 |
7 | **Naming rules for route names**
8 |
9 | - First-level route: `demo`, `demo-page`, `route1`
10 | > The name is in the form of lowercase with hyphen `-`
11 | - Second-level route: `demo2_child`, `demo2-page_child`, `route2_child`
12 | > The level of the route is separated by an underscore `_`, and both sides still follow the naming rules of the first-level route
13 | - Third-level and above routes: `demo3_child_child`, `demo3-page_child_child_child`
14 |
15 | ## Manual Creation
16 |
17 | **When manually creating route files, the following rules need to be followed:**
18 | The name of the folder for each level of route is the route name, and the index.vue or [id].vue under the folder is the route component.
19 |
--------------------------------------------------------------------------------
/src/guide/router/dynamic.md:
--------------------------------------------------------------------------------
1 | # Route Permissions
2 |
3 | ::: tip
4 | This document was generated by machine translation. If there are any errors, please inform us
5 | :::
6 |
7 | ## Guide
8 |
9 | ### Fixed Routes (Routes Accessible Without Permission)
10 |
11 | In static route mode, route permissions are controlled by `meta.constant`. Routes with `constant` set to `true` can be accessed without logging in;
12 | In dynamic route mode, routes accessible without logging in need to be returned in the `fetchGetConstantRoutes` interface. In other words, routes with `constant` set to `true` returned in `fetchGetUserRoutes` will not take effect and still require login to access;
13 |
14 | ### Permission Routes
15 |
16 | In static route mode, by default, routes require login to access. To configure permissions, you can add the `meta.roles` field. This field's type is `string[]`, configured in `UserInfo`. If a matching role is found, access is allowed, otherwise not. Matching occurs in the pre-route guard phase;
17 | In dynamic route mode, `meta.roles` can still be used, but it's generally preferred to let the backend control the route table return based on role permissions, excluding unauthorized routes;
18 |
19 | ## Dynamic Routes
20 |
21 | Modify the source of routes. The route table for static routes comes from `./src/router/elegant/routes.ts`, while the route table for dynamic routes comes from the `fetchGetConstantRoutes` and `fetchGetUserRoutes` interfaces.
22 |
23 | > [!WARNING] Note
24 | > The type of the route table returned by the interface must be consistent with the frontend's static route table type. Before attempting modifications, it is advisable to familiarize yourself with the project's unique route plugin and route table structure
25 |
26 | ### Enable/Disable
27 |
28 | Enable/disable dynamic route mode by configuring the `VITE_AUTH_ROUTE_MODE` variable in the `.env` file.
29 |
30 | ::: tip Code Location
31 | .env
32 | :::
33 |
34 | ```dotenv:line-numbers=14
35 | # auth route mode: static | dynamic
36 | VITE_AUTH_ROUTE_MODE=dynamic
37 | ```
38 |
--------------------------------------------------------------------------------
/src/guide/router/guard.md:
--------------------------------------------------------------------------------
1 | # Router Guard
2 |
3 | ## Router guard flow
4 |
5 | 
6 |
7 | [HD PDF](/router-guard-flow.pdf)
8 |
--------------------------------------------------------------------------------
/src/guide/router/intro.md:
--------------------------------------------------------------------------------
1 | # System Routing
2 |
3 | The routing of this system is based on the plugin [Elegant Router](https://github.com/soybeanjs/elegant-router). For detailed usage, please refer to the plugin documentation.
4 |
5 | ::: danger
6 | Since the `` tag is used to support page transition animations, there can only be one root element in the `template` of the `.vue` file, and neither annotations nor plain text can be used, there must be only one root element.
7 | Related Documents: [Transition | Vue.js (vuejs.org)](https://cn.vuejs.org/guide/built-ins/transition.html#the-transition-component)
8 | :::
9 |
10 | ## Auto-generation
11 |
12 | After starting the project, the plugin will automatically generate the src/router/elegant directory. The files in this directory are automatically generated files for route import, route definition, and route conversion.
13 |
14 | > [!IMPORTANT]
15 | > Routing is a byproduct of files, so deleting a route is deleting a file, and the route will disappear along with the file. The only content that can be modified by routing is the `component` and `meta` information, and the automatically generated operation will not affect these two properties.
16 |
17 | ## Configuration properties
18 |
19 | ### 1. type RouteKey
20 |
21 | **Explanation:**
22 |
23 | The union type RouteKey declares all route keys for easy unified management of routes. This type is automatically generated by the plugin [Elegant Router](https://github.com/soybeanjs/elegant-router) based on the page files under views.
24 |
25 | ::: tip Code location
26 | src/typings/elegant-router.d.ts
27 | :::
28 |
29 | ### 2. type RoutePath
30 |
31 | **Explanation:**
32 |
33 | The path of the route, this type corresponds one-to-one with RouteKey
34 |
35 | ### 3. type RouteMeta
36 |
37 | ```typescript
38 | // Route meta information interface
39 | interface RouteMeta {
40 | /**
41 | * Route title
42 | *
43 | * Can be used in the document title
44 | */
45 | title: string;
46 | /**
47 | * The internationalization key of the route
48 | *
49 | * If set, it will be used for i18n, and the title will be ignored at this time
50 | */
51 | i18nKey?: App.I18n.I18nKey;
52 | /**
53 | * The role list of the route
54 | *
55 | * When the current user has at least one role, the route is allowed to be accessed. When the role list is empty, it means no permission is required
56 | */
57 | roles?: string[];
58 | /** Whether to cache this route */
59 | keepAlive?: boolean;
60 | /**
61 | * Whether it is a constant route
62 | *
63 | * No login is required, and the route is defined on the front end
64 | */
65 | constant?: boolean;
66 | /**
67 | * Iconify icon
68 | *
69 | * Can be used in the menu or breadcrumbs
70 | */
71 | icon?: string;
72 | /**
73 | * Local icon
74 | *
75 | * Located in the "src/assets/svg-icon" directory, if set, the icon property will be ignored
76 | */
77 | localIcon?: string;
78 | /** Route sorting order */
79 | order?: number;
80 | /** The external link of the route */
81 | href?: string;
82 | /** Whether to hide this route in the menu */
83 | hideInMenu?: boolean;
84 | /**
85 | * The menu key activated when entering this route
86 | *
87 | * This route is not in the menu
88 | *
89 | * @example
90 | * Suppose the route is "user_detail", if set to "user_list", the "User List" menu item will be activated
91 | */
92 | activeMenu?: import('@elegant-router/types').RouteKey;
93 | /** By default, routes with the same path share a tab. If set to true, multiple tabs are used */
94 | multiTab?: boolean;
95 | /** If set, the route will be displayed fixed in the tab, and its value represents the order of the fixed tab.(The home page is special, it will automatically stay fixed) */
96 | fixedIndexInTab?: number;
97 | /** if set query parameters, it will be automatically carried when entering the route */
98 | query?: { key: string; value: string }[] | null;
99 | }
100 | ```
101 |
102 | ::: tip Tip
103 | Get the icon value from here: [https://icones.js.org/](https://icones.js.org/)
104 | :::
105 |
106 | ## Note
107 |
108 | If you create a route page in views, call it elsewhere but do not show it in the menu, then you need to set `hideInMenu: true` in meta
109 |
110 | ```typescript
111 | {
112 | name: '403',
113 | path: '/403',
114 | component: 'layout.blank$view.403',
115 | meta: {
116 | title: '403',
117 | i18nKey: 'route.403',
118 | hideInMenu: true
119 | }
120 | }
121 | ```
122 |
--------------------------------------------------------------------------------
/src/guide/router/push.md:
--------------------------------------------------------------------------------
1 | # Router Push
2 |
3 | ::: tip
4 | This document was generated by machine translation. If there are any errors, please inform us
5 | :::
6 |
7 | In the project, you can use normal `router.push` and other conventional ways to route jump, you can also use the project provides `useRouterPush` to jump (recommended), this article mainly introduces `useRouterPush`.
8 |
9 | ## Introduce
10 |
11 | This hook encapsulates `router.push` and is intended to be used in place of `router.push` to make jumping easier. `useRouterPush` returns an object containing the following properties and methods:
12 |
13 | - routerPush: The push method of the Vue Router.
14 | - routerBack: The back method of the Vue Router.
15 | - routerPushByKey: The method to push based on the route key.
16 | - toLogin: method to jump to the login page.
17 | - toggleLoginModule: Method to toggle the login module.
18 | - redirectFromLogin: method to redirect from login page.
19 |
20 | ::: warning
21 | Pass `false` to `useRouterPush` when used outside of `setup`.
22 | :::
23 |
24 | ## explanation
25 |
26 | `routerPush` and `routerBack` are all original attributes, so I won't go into them again, but I'll focus on the latter ones here.
27 |
28 | ### routerPushByKey
29 |
30 | The `key` here refers to the `name` attribute of the route, e.g. a route configured as:
31 |
32 | ```json
33 | {
34 | "name": "soybean",
35 | "path": "/soybean-page",
36 | "component": "layout.base$view.soybean-page"
37 | }
38 | ```
39 |
40 | Then the code to jump to that route is:
41 |
42 | ```ts
43 | import { useRouterPush } from '@/hooks/common/router';
44 |
45 | const { routerPushByKey } = useRouterPush();
46 |
47 | routerPushByKey('soybean');
48 | ```
49 |
50 | It supports passing optional parameters `query` or `params`.
51 |
52 | ### toLogin
53 |
54 | Literally, quickly jump to the login page, note that before jumping to clear the login information, otherwise in the route guard will be intercepted back to the home page of the same.
55 |
56 | ### toggleLoginModule
57 |
58 | The method passes in parameters of type is:
59 |
60 | ```ts
61 | /**
62 | * The login module
63 | *
64 | * - pwd-login: password login
65 | * - code-login: phone code login
66 | * - register: register
67 | * - reset-pwd: reset password
68 | * - bind-wechat: bind wechat
69 | */
70 | type LoginModule = 'pwd-login' | 'code-login' | 'register' | 'reset-pwd' | 'bind-wechat';
71 | ```
72 |
73 | The function is to change the login module mounted on the login page based on the `LoginModule` passed in, you can remove or extend it yourself, just make sure it's of the right type.
74 |
75 | ### redirectFromLogin
76 |
77 | In the case of a successful login, it's better to see the name than to manually `push` it to the homepage.
78 | It will decide which route to redirect to based on the `redirect` query parameter of the login page, if there is no `redirect` parameter, it will jump to the home page by default.
79 |
80 | ## Use
81 |
82 | ```vue
83 |
84 |
89 |
90 |
91 |
92 | 返回首页
93 |
94 |
95 | ```
96 |
97 | ```ts
98 |
99 | import { useRouterPush } from '@/hooks/common/router';
100 |
101 | // Note that passing in false
102 | const { routerPushByKey } = useRouterPush(false);
103 |
104 | function backToRoot() {
105 | routerPushByKey('root')
106 | }
107 | ```
108 |
--------------------------------------------------------------------------------
/src/guide/sync.md:
--------------------------------------------------------------------------------
1 | # Sync code
2 |
3 | 1. Add the `soybean-admin` git address to your own repository
4 |
5 | ```bash
6 | git remote add otherOrigin https://github.com/soybeanjs/soybean-admin.git
7 | ```
8 |
9 | 2. Pull the code
10 |
11 | ```bash
12 | git fetch otherOrigin
13 | ```
14 |
15 | 3. Pick the git commit that needs to be updated through `cherry-pick`
16 |
17 | ```bash
18 | git cherry-pick [commit id]
19 | ```
20 |
21 | 4. When there is a conflict in the code, resolve the conflict, then excute the following command, and then execute `vim` to save
22 |
23 | ```bash
24 | git cherry-pick --continue
25 | ```
26 |
27 | > `vim` save operation: `esc`, `:`, `wq`, `enter`
28 |
--------------------------------------------------------------------------------
/src/guide/theme/config.md:
--------------------------------------------------------------------------------
1 | # Theme Config
2 |
3 | ## Typedef
4 |
5 | Reference `App.Theme.ThemeSetting`
6 |
7 | ::: tip source file
8 | src/typings/app.d.ts
9 | :::
10 |
11 | ## Initial Config
12 |
13 | ```ts
14 | export const themeSettings: App.Theme.ThemeSetting = {
15 | //default config
16 | };
17 | ```
18 |
19 | ::: tip source file
20 | src/theme/settings.ts
21 | :::
22 |
23 | ## Override Update
24 |
25 | When a new version is released, the theme config can be updated by configuring the override update method.
26 |
27 | ```ts
28 | export const overrideThemeSettings: Partial = {
29 | //override config
30 | };
31 | ```
32 |
33 | ::: tip source file
34 | src/theme/settings.ts
35 | :::
36 |
37 | ## About Environment
38 |
39 | - When the project is in `dev`, the theme config will not be cached, but you can update the theme config by updating the`themeSettings` in`src/theme/settings.ts`
40 |
41 | > To see the changes in the theme config in real-time during the development stage, the theme config will not be cached.
42 |
43 | - When the project is in `prod`, the theme config will be cached in `localStorage`
44 |
45 | > Each time a new version is released, the theme config can be overridden by updating the `overrideThemeSettings` in `src/theme/settings.ts`.
46 |
--------------------------------------------------------------------------------
/src/guide/theme/intro.md:
--------------------------------------------------------------------------------
1 | # System Theme
2 |
3 | The implementation of the system theme is divided into two parts, one part is the theme configuration of the component library, and the other part is the theme configuration of UnoCSS. In order to unify the theme configuration of the two parts, some theme configurations are maintained on this, which control the theme configuration of the component library and UnoCSS respectively through these theme configurations.
4 |
5 | ## Principle
6 |
7 | - Define some variables of theme configuration, including various theme colors, layout parameter configuration, etc.
8 | - Produce theme variables that conform to the component library through these configurations
9 | - Produce some theme tokens through these configurations and derive corresponding css variables, and then pass these css variables to UnoCSS
10 |
--------------------------------------------------------------------------------
/src/guide/theme/loading.md:
--------------------------------------------------------------------------------
1 | # System Loading
2 |
3 | 
4 |
5 | ## Style
6 |
7 | - The loading style during system initialization is implemented through HTML code
8 |
9 | ::: tip Component location
10 | src/plugins/loading.ts
11 | :::
12 |
13 | - The system's Logo is implemented using the SystemLogo component
14 |
15 | [System Logo](./logo.md)
16 |
17 | ## Rendering Principle
18 |
19 | Create a setupLoading function, its main function is to set the animation effect when the page is loading.
20 | This loading animation includes a system Logo, a rotating dot matrix animation, and title text, and all element colors are dynamically generated based on the theme color themeColor obtained from local storage.
21 | And find the element with ID 'app' in the DOM as the mounting point for the loading animation. If this element is found, its internal HTML will be replaced with the just constructed loading animation HTML structure
22 |
23 | ```ts
24 | export function setupLoading() {
25 | const themeColor = localStg.get('themeColor') || '#DB5A6B';
26 |
27 | const { r, g, b } = getRgbOfColor(themeColor);
28 |
29 | const primaryColor = `--primary-color: ${r} ${g} ${b}`;
30 |
31 | const loadingClasses = [
32 | 'left-0 top-0',
33 | 'left-0 bottom-0 animate-delay-500',
34 | 'right-0 top-0 animate-delay-1000',
35 | 'right-0 bottom-0 animate-delay-1500'
36 | ];
37 |
38 | const logoWithClass = systemLogo.replace('