diff --git a/.gitignore b/.gitignore index c2a8a771fa2..3f4cf1a2c9a 100644 --- a/.gitignore +++ b/.gitignore @@ -5,6 +5,7 @@ dist-ssr dist.zip dist.tar dist.war +dist-electron .nitro .output *-dist.zip diff --git a/.gitpod.yml b/.gitpod.yml index fb75b433d90..5fda2cf70ae 100644 --- a/.gitpod.yml +++ b/.gitpod.yml @@ -2,5 +2,5 @@ ports: - port: 5555 onOpen: open-preview tasks: - - init: corepack enable && pnpm install + - init: npm i -g corepack && pnpm install command: pnpm run dev:play diff --git a/.husky/commit-msg b/.husky/commit-msg deleted file mode 100755 index 270ebb8c1c6..00000000000 --- a/.husky/commit-msg +++ /dev/null @@ -1,6 +0,0 @@ -echo Start running commit-msg hook... - -# Check whether the git commit information is standardized -pnpm exec commitlint --edit "$1" - -echo Run commit-msg hook done. diff --git a/.husky/post-merge b/.husky/post-merge deleted file mode 100644 index 83fa775d585..00000000000 --- a/.husky/post-merge +++ /dev/null @@ -1,3 +0,0 @@ -# 每次 git pull 之后, 安装依赖 - -pnpm install diff --git a/.husky/pre-commit b/.husky/pre-commit deleted file mode 100755 index 5dccee288f3..00000000000 --- a/.husky/pre-commit +++ /dev/null @@ -1,7 +0,0 @@ -# update `.vscode/vben-admin.code-workspace` file -pnpm vsh code-workspace --auto-commit - -# Format and submit code according to lintstagedrc.js configuration -pnpm exec lint-staged - -echo Run pre-commit hook done. diff --git a/.lintstagedrc.mjs b/.lintstagedrc.mjs deleted file mode 100644 index 94b0192a75b..00000000000 --- a/.lintstagedrc.mjs +++ /dev/null @@ -1,20 +0,0 @@ -export default { - '*.md': ['prettier --cache --ignore-unknown --write'], - '*.vue': [ - 'prettier --write', - 'eslint --cache --fix', - 'stylelint --fix --allow-empty-input', - ], - '*.{js,jsx,ts,tsx}': [ - 'prettier --cache --ignore-unknown --write', - 'eslint --cache --fix', - ], - '*.{scss,less,styl,html,vue,css}': [ - 'prettier --cache --ignore-unknown --write', - 'stylelint --fix --allow-empty-input', - ], - 'package.json': ['prettier --cache --write'], - '{!(package)*.json,*.code-snippets,.!(browserslist)*rc}': [ - 'prettier --cache --write--parser json', - ], -}; diff --git a/.node-version b/.node-version index 48b14e6b2b5..ee5c2446981 100644 --- a/.node-version +++ b/.node-version @@ -1 +1 @@ -20.14.0 +22.1.0 diff --git a/.npmrc b/.npmrc index f4a1ad483b0..ae71d48e8f5 100644 --- a/.npmrc +++ b/.npmrc @@ -1,4 +1,7 @@ registry = "https://registry.npmmirror.com" +ELECTRON_MIRROR="https://npmmirror.com/mirrors/electron/" +public-hoist-pattern[]=lefthook +ELECTRON_MIRROR="https://npmmirror.com/mirrors/electron/" public-hoist-pattern[]=husky public-hoist-pattern[]=eslint public-hoist-pattern[]=prettier diff --git a/.vscode/settings.json b/.vscode/settings.json index da724dd172e..f38c4278142 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -14,7 +14,7 @@ "editor.tabSize": 2, "editor.detectIndentation": false, "editor.cursorBlinking": "expand", - "editor.largeFileOptimizations": false, + "editor.largeFileOptimizations": true, "editor.accessibilitySupport": "off", "editor.cursorSmoothCaretAnimation": "on", "editor.guides.bracketPairs": "active", @@ -91,6 +91,7 @@ "**/bower_components": true, "**/.turbo": true, "**/.idea": true, + "**/.vitepress": true, "**/tmp": true, "**/.git": true, "**/.svn": true, @@ -112,6 +113,8 @@ "**/yarn.lock": true }, + "typescript.tsserver.exclude": ["**/node_modules", "**/dist", "**/.turbo"], + // search "search.searchEditor.singleClickBehaviour": "peekDefinition", "search.followSymlinks": false, @@ -216,7 +219,7 @@ "*.env": "$(capture).env.*", "README.md": "README*,CHANGELOG*,LICENSE,CNAME", "package.json": "pnpm-lock.yaml,pnpm-workspace.yaml,.gitattributes,.gitignore,.gitpod.yml,.npmrc,.browserslistrc,.node-version,.git*,.tazerc.json", - "eslint.config.mjs": ".eslintignore,.prettierignore,.stylelintignore,.commitlintrc.*,.prettierrc.*,stylelint.config.*,.lintstagedrc.mjs,cspell.json", + "eslint.config.mjs": ".eslintignore,.prettierignore,.stylelintignore,.commitlintrc.*,.prettierrc.*,stylelint.config.*,.lintstagedrc.mjs,cspell.json,lefthook.yml", "tailwind.config.mjs": "postcss.*" }, "commentTranslate.hover.enabled": false, diff --git a/README.ja-JP.md b/README.ja-JP.md index baa4cc44868..f7847a1d9d6 100644 --- a/README.ja-JP.md +++ b/README.ja-JP.md @@ -1,8 +1,13 @@ -
VbenAdmin Logo

+
+ + VbenAdmin Logo + +
+
[![license](https://img.shields.io/github/license/anncwb/vue-vben-admin.svg)](LICENSE) -

Vue Vben Admin

+

Vue Vben Admin

[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=vbenjs_vue-vben-admin&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=vbenjs_vue-vben-admin) ![codeql](https://github.com/vbenjs/vue-vben-admin/actions/workflows/codeql.yml/badge.svg) ![build](https://github.com/vbenjs/vue-vben-admin/actions/workflows/build.yml/badge.svg) ![ci](https://github.com/vbenjs/vue-vben-admin/actions/workflows/ci.yml/badge.svg) ![deploy](https://github.com/vbenjs/vue-vben-admin/actions/workflows/deploy.yml/badge.svg) @@ -15,27 +20,27 @@ Vue Vben Adminは、最新の`vue3`、`vite`、`TypeScript`などの主流技術 ## アップグレード通知 -これは最新バージョン5.0であり、以前のバージョンとは互換性がありません。新しいプロジェクトを開始する場合は、最新バージョンを使用することをお勧めします。古いバージョンを表示したい場合は、[v2ブランチ](https://github.com/vbenjs/vue-vben-admin/tree/v2)を使用してください。 +これは最新バージョン `5.0` であり、以前のバージョンとは互換性がありません。新しいプロジェクトを開始する場合は、最新バージョンを使用することをお勧めします。古いバージョンを表示したい場合は、[v2ブランチ](https://github.com/vbenjs/vue-vben-admin/tree/v2)を使用してください。 ## 特徴 -- **最新技術スタック**: Vue 3やViteなどの最先端フロントエンド技術で開発 -- **TypeScript**: アプリケーション規模のJavaScriptのための言語 -- **テーマ**: 複数のテーマカラーが利用可能で、カスタマイズオプションも豊富 -- **国際化**: 完全な内蔵国際化サポート -- **権限管理**: 動的ルートベースの権限生成ソリューションを内蔵 +- **最新技術スタック**:Vue 3やViteなどの最先端フロントエンド技術で開発 +- **TypeScript**:アプリケーション規模のJavaScriptのための言語 +- **テーマ**:複数のテーマカラーが利用可能で、カスタマイズオプションも豊富 +- **国際化**:完全な内蔵国際化サポート +- **権限管理**:動的ルートベースの権限生成ソリューションを内蔵 ## プレビュー - [Vben Admin](https://vben.pro/) - フルバージョンの中国語サイト -テストアカウント: vben/123456 +テストアカウント:vben/123456 -

- VbenAdmin Logo - VbenAdmin Logo - VbenAdmin Logo -

+
+ VbenAdmin Logo + VbenAdmin Logo + VbenAdmin Logo +
### Gitpodを使用 @@ -49,30 +54,27 @@ Gitpod(GitHub用の無料オンライン開発環境)でプロジェクト ## インストールと使用 -- プロジェクトコードを取得 +1. プロジェクトコードを取得 ```bash git clone https://github.com/vbenjs/vue-vben-admin.git ``` -- 依存関係のインストール +2. 依存関係のインストール ```bash cd vue-vben-admin - -corepack enable - +npm i -g corepack pnpm install - ``` -- 実行 +3. 実行 ```bash pnpm dev ``` -- ビルド +4. ビルド ```bash pnpm build @@ -86,40 +88,39 @@ pnpm build ご参加をお待ちしております![Issueを提出](https://github.com/anncwb/vue-vben-admin/issues/new/choose)するか、Pull Requestを送信してください。 -**Pull Request:** +**Pull Request プロセス:** -1. コードをフォーク! -2. 自分のブランチを作成: `git checkout -b feat/xxxx` -3. 変更をコミット: `git commit -am 'feat(function): add xxxxx'` -4. ブランチをプッシュ: `git push origin feat/xxxx` +1. コードをフォーク +2. 自分のブランチを作成:`git checkout -b feat/xxxx` +3. 変更をコミット:`git commit -am 'feat(function): add xxxxx'` +4. ブランチをプッシュ:`git push origin feat/xxxx` 5. `pull request`を送信 ## Git貢献提出規則 -- 参考 [vue](https://github.com/vuejs/vue/blob/dev/.github/COMMIT_CONVENTION.md) 規則 ([Angular](https://github.com/conventional-changelog/conventional-changelog/tree/master/packages/conventional-changelog-angular)) - - - `feat` 新機能の追加 - - `fix` 問題/バグの修正 - - `style` コードスタイルに関連し、実行結果に影響しない - - `perf` 最適化/パフォーマンス向上 - - `refactor` リファクタリング - - `revert` 変更の取り消し - - `test` テスト関連 - - `docs` ドキュメント/注釈 - - `chore` 依存関係の更新/スキャフォールディング設定の変更など - - `ci` 継続的インテグレーション - - `types` 型定義ファイルの変更 - - `wip` 開発中 +参考 [vue](https://github.com/vuejs/vue/blob/dev/.github/COMMIT_CONVENTION.md) 規則 ([Angular](https://github.com/conventional-changelog/conventional-changelog/tree/master/packages/conventional-changelog-angular)) + +- `feat` 新機能の追加 +- `fix` 問題/バグの修正 +- `style` コードスタイルに関連し、実行結果に影響しない +- `perf` 最適化/パフォーマンス向上 +- `refactor` リファクタリング +- `revert` 変更の取り消し +- `test` テスト関連 +- `docs` ドキュメント/注釈 +- `chore` 依存関係の更新/スキャフォールディング設定の変更など +- `ci` 継続的インテグレーション +- `types` 型定義ファイルの変更 ## ブラウザサポート -ローカル開発には`Chrome 80+`ブラウザを推奨します +ローカル開発には `Chrome 80+` ブラウザを推奨します モダンブラウザをサポートし、IEはサポートしません -| [ Edge](http://godban.github.io/browsers-support-badges/)
IE | [ Edge](http://godban.github.io/browsers-support-badges/)
Edge | [Firefox](http://godban.github.io/browsers-support-badges/)
Firefox | [Chrome](http://godban.github.io/browsers-support-badges/)
Chrome | [Safari](http://godban.github.io/browsers-support-badges/)
Safari | -| :-: | :-: | :-: | :-: | :-: | -| サポートしない | 最新2バージョン | 最新2バージョン | 最新2バージョン | 最新2バージョン | +| [Edge](http://godban.github.io/browsers-support-badges/)
Edge | [Firefox](http://godban.github.io/browsers-support-badges/)
Firefox | [Chrome](http://godban.github.io/browsers-support-badges/)
Chrome | [Safari](http://godban.github.io/browsers-support-badges/)
Safari | +| :-: | :-: | :-: | :-: | +| 最新2バージョン | 最新2バージョン | 最新2バージョン | 最新2バージョン | ## メンテナー @@ -140,8 +141,7 @@ pnpm build ## 貢献者 - Contributors + Contributors ## Discord diff --git a/README.md b/README.md index e84c8392ef5..e027949abe6 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,13 @@ -
VbenAdmin Logo

+
+ + VbenAdmin Logo + +
+
[![license](https://img.shields.io/github/license/anncwb/vue-vben-admin.svg)](LICENSE) -

Vue Vben Admin

+

Vue Vben Admin

[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=vbenjs_vue-vben-admin&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=vbenjs_vue-vben-admin) ![codeql](https://github.com/vbenjs/vue-vben-admin/actions/workflows/codeql.yml/badge.svg) ![build](https://github.com/vbenjs/vue-vben-admin/actions/workflows/build.yml/badge.svg) ![ci](https://github.com/vbenjs/vue-vben-admin/actions/workflows/ci.yml/badge.svg) ![deploy](https://github.com/vbenjs/vue-vben-admin/actions/workflows/deploy.yml/badge.svg) @@ -17,7 +22,7 @@ Vue Vben Admin is a free and open source middle and back-end template. Using the This is the latest version, 5.0, and it is not compatible with previous versions. If you are starting a new project, it is recommended to use the latest version. If you wish to view the old version, please use the [v2 branch](https://github.com/vbenjs/vue-vben-admin/tree/v2). -## Feature +## Features - **Latest Technology Stack**: Developed with cutting-edge front-end technologies like Vue 3 and Vite - **TypeScript**: A language for application-scale JavaScript @@ -31,11 +36,11 @@ This is the latest version, 5.0, and it is not compatible with previous versions Test Account: vben/123456 -

- VbenAdmin Logo - VbenAdmin Logo - VbenAdmin Logo -

+
+ VbenAdmin Logo + VbenAdmin Logo + VbenAdmin Logo +
### Use Gitpod @@ -47,31 +52,29 @@ Open the project in Gitpod (free online dev environment for GitHub) and start co [Document](https://doc.vben.pro/) -## Install and use +## Install and Use -- Get the project code +1. Get the project code ```bash git clone https://github.com/vbenjs/vue-vben-admin.git ``` -- Installation dependencies +2. Install dependencies ```bash cd vue-vben-admin - -corepack enable - +npm i -g corepack pnpm install ``` -- run +3. Run ```bash pnpm dev ``` -- build +4. Build ```bash pnpm build @@ -81,44 +84,43 @@ pnpm build [CHANGELOG](https://github.com/vbenjs/vue-vben-admin/releases) -## How to contribute +## How to Contribute -You are very welcome to join![Raise an issue](https://github.com/anncwb/vue-vben-admin/issues/new/choose) Or submit a Pull Request。 +You are very welcome to join! [Raise an issue](https://github.com/anncwb/vue-vben-admin/issues/new/choose) or submit a Pull Request. -**Pull Request:** +**Pull Request Process:** -1. Fork code! -2. Create your own branch: `git checkout -b feat/xxxx` +1. Fork the code +2. Create your branch: `git checkout -b feat/xxxx` 3. Submit your changes: `git commit -am 'feat(function): add xxxxx'` 4. Push your branch: `git push origin feat/xxxx` -5. submit`pull request` +5. Submit `pull request` -## Git Contribution submission specification +## Git Contribution Submission Specification -- reference [vue](https://github.com/vuejs/vue/blob/dev/.github/COMMIT_CONVENTION.md) specification ([Angular](https://github.com/conventional-changelog/conventional-changelog/tree/master/packages/conventional-changelog-angular)) +Reference [vue](https://github.com/vuejs/vue/blob/dev/.github/COMMIT_CONVENTION.md) specification ([Angular](https://github.com/conventional-changelog/conventional-changelog/tree/master/packages/conventional-changelog-angular)) - - `feat` Add new features - - `fix` Fix the problem/BUG - - `style` The code style is related and does not affect the running result - - `perf` Optimization/performance improvement - - `refactor` Refactor - - `revert` Undo edit - - `test` Test related - - `docs` Documentation/notes - - `chore` Dependency update/scaffolding configuration modification etc. - - `ci` Continuous integration - - `types` Type definition file changes - - `wip` In development +- `feat` Add new features +- `fix` Fix the problem/BUG +- `style` The code style is related and does not affect the running result +- `perf` Optimization/performance improvement +- `refactor` Refactor +- `revert` Undo edit +- `test` Test related +- `docs` Documentation/notes +- `chore` Dependency update/scaffolding configuration modification etc. +- `ci` Continuous integration +- `types` Type definition file changes -## Browser support +## Browser Support The `Chrome 80+` browser is recommended for local development Support modern browsers, not IE -| [ Edge](http://godban.github.io/browsers-support-badges/)
IE | [ Edge](http://godban.github.io/browsers-support-badges/)
Edge | [Firefox](http://godban.github.io/browsers-support-badges/)
Firefox | [Chrome](http://godban.github.io/browsers-support-badges/)
Chrome | [Safari](http://godban.github.io/browsers-support-badges/)
Safari | -| :-: | :-: | :-: | :-: | :-: | -| not support | last 2 versions | last 2 versions | last 2 versions | last 2 versions | +| [Edge](http://godban.github.io/browsers-support-badges/)
Edge | [Firefox](http://godban.github.io/browsers-support-badges/)
Firefox | [Chrome](http://godban.github.io/browsers-support-badges/)
Chrome | [Safari](http://godban.github.io/browsers-support-badges/)
Safari | +| :-: | :-: | :-: | :-: | +| last 2 versions | last 2 versions | last 2 versions | last 2 versions | ## Maintainer @@ -136,11 +138,10 @@ If you think this project is helpful to you, you can help the author buy a cup o Paypal Me -## Contributor +## Contributors - Contributors + Contributors ## Discord diff --git a/README.zh-CN.md b/README.zh-CN.md index e2f05bb98be..5a6b191b838 100644 --- a/README.zh-CN.md +++ b/README.zh-CN.md @@ -1,8 +1,13 @@ -
VbenAdmin Logo

+
+ + VbenAdmin Logo + +
+
[![license](https://img.shields.io/github/license/anncwb/vue-vben-admin.svg)](LICENSE) -

Vue Vben Admin

+

Vue Vben Admin

[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=vbenjs_vue-vben-admin&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=vbenjs_vue-vben-admin) ![codeql](https://github.com/vbenjs/vue-vben-admin/actions/workflows/codeql.yml/badge.svg) ![build](https://github.com/vbenjs/vue-vben-admin/actions/workflows/build.yml/badge.svg) ![ci](https://github.com/vbenjs/vue-vben-admin/actions/workflows/ci.yml/badge.svg) ![deploy](https://github.com/vbenjs/vue-vben-admin/actions/workflows/deploy.yml/badge.svg) @@ -15,31 +20,31 @@ Vue Vben Admin 是 Vue Vben Admin 的升级版本。作为一个免费开源的 ## 升级提示 -该版本为最新版本`5.0`, 与其他版本不兼容,如果你是新项目,建议使用最新版本。如果你想查看旧版本,请使用 [v2 分支](https://github.com/vbenjs/vue-vben-admin/tree/v2) +该版本为最新版本 `5.0`,与其他版本不兼容,如果你是新项目,建议使用最新版本。如果你想查看旧版本,请使用 [v2 分支](https://github.com/vbenjs/vue-vben-admin/tree/v2) ## 特性 - **最新技术栈**:使用 Vue3/vite 等前端前沿技术开发 -- **TypeScript**: 应用程序级 JavaScript 的语言 +- **TypeScript**:应用程序级 JavaScript 的语言 - **主题**:提供多套主题色彩,可配置自定义主题 - **国际化**:内置完善的国际化方案 -- **权限** 内置完善的动态路由权限生成方案 +- **权限**:内置完善的动态路由权限生成方案 ## 预览 - [Vben Admin](https://vben.pro/) - 完整版中文站点 -测试账号: vben/123456 +测试账号:vben/123456 -

- VbenAdmin Logo - VbenAdmin Logo - VbenAdmin Logo -

+
+ VbenAdmin Logo + VbenAdmin Logo + VbenAdmin Logo +
### 使用 Gitpod -在 Gitpod(适用于 GitHub 的免费在线开发环境)中打开项目,并立即开始编码. +在 Gitpod(适用于 GitHub 的免费在线开发环境)中打开项目,并立即开始编码。 [![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/#https://github.com/vbenjs/vue-vben-admin) @@ -49,29 +54,27 @@ Vue Vben Admin 是 Vue Vben Admin 的升级版本。作为一个免费开源的 ## 安装使用 -- 获取项目代码 +1. 获取项目代码 ```bash git clone https://github.com/vbenjs/vue-vben-admin.git ``` -- 安装依赖 +2. 安装依赖 ```bash cd vue-vben-admin - -corepack enable - +npm i -g corepack pnpm install ``` -- 运行 +3. 运行 ```bash pnpm dev ``` -- 打包 +4. 打包 ```bash pnpm build @@ -85,68 +88,66 @@ pnpm build 非常欢迎你的加入![提一个 Issue](https://github.com/anncwb/vue-vben-admin/issues/new/choose) 或者提交一个 Pull Request。 -**Pull Request:** +**Pull Request 流程:** -1. Fork 代码! -2. 创建自己的分支: `git checkout -b feature/xxxx` -3. 提交你的修改: `git commit -am 'feat(function): add xxxxx'` -4. 推送您的分支: `git push origin feature/xxxx` -5. 提交`pull request` +1. Fork 代码 +2. 创建自己的分支:`git checkout -b feature/xxxx` +3. 提交你的修改:`git commit -am 'feat(function): add xxxxx'` +4. 推送您的分支:`git push origin feature/xxxx` +5. 提交 `pull request` ## Git 贡献提交规范 -- 参考 [vue](https://github.com/vuejs/vue/blob/dev/.github/COMMIT_CONVENTION.md) 规范 ([Angular](https://github.com/conventional-changelog/conventional-changelog/tree/master/packages/conventional-changelog-angular)) - - - `feat` 增加新功能 - - `fix` 修复问题/BUG - - `style` 代码风格相关无影响运行结果的 - - `perf` 优化/性能提升 - - `refactor` 重构 - - `revert` 撤销修改 - - `test` 测试相关 - - `docs` 文档/注释 - - `chore` 依赖更新/脚手架配置修改等 - - `ci` 持续集成 - - `types` 类型定义文件更改 - - `wip` 开发中 +参考 [vue](https://github.com/vuejs/vue/blob/dev/.github/COMMIT_CONVENTION.md) 规范 ([Angular](https://github.com/conventional-changelog/conventional-changelog/tree/master/packages/conventional-changelog-angular)) + +- `feat` 增加新功能 +- `fix` 修复问题/BUG +- `style` 代码风格相关无影响运行结果的 +- `perf` 优化/性能提升 +- `refactor` 重构 +- `revert` 撤销修改 +- `test` 测试相关 +- `docs` 文档/注释 +- `chore` 依赖更新/脚手架配置修改等 +- `ci` 持续集成 +- `types` 类型定义文件更改 ## 浏览器支持 -本地开发推荐使用`Chrome 80+` 浏览器 +本地开发推荐使用 `Chrome 80+` 浏览器 -支持现代浏览器, 不支持 IE +支持现代浏览器,不支持 IE -| [ Edge](http://godban.github.io/browsers-support-badges/)
IE | [ Edge](http://godban.github.io/browsers-support-badges/)
Edge | [Firefox](http://godban.github.io/browsers-support-badges/)
Firefox | [Chrome](http://godban.github.io/browsers-support-badges/)
Chrome | [Safari](http://godban.github.io/browsers-support-badges/)
Safari | -| :-: | :-: | :-: | :-: | :-: | -| not support | last 2 versions | last 2 versions | last 2 versions | last 2 versions | +| [Edge](http://godban.github.io/browsers-support-badges/)
Edge | [Firefox](http://godban.github.io/browsers-support-badges/)
Firefox | [Chrome](http://godban.github.io/browsers-support-badges/)
Chrome | [Safari](http://godban.github.io/browsers-support-badges/)
Safari | +| :-: | :-: | :-: | :-: | +| last 2 versions | last 2 versions | last 2 versions | last 2 versions | ## 维护者 [@Vben](https://github.com/anncwb) -## Star History +## Star 历史 [![Star History Chart](https://api.star-history.com/svg?repos=vbenjs/vue-vben-admin&type=Date)](https://star-history.com/#vbenjs/vue-vben-admin&Date) ## 捐赠 -如果你觉得这个项目对你有帮助,你可以帮作者买一杯咖啡表示支持! +如果你觉得这个项目对你有帮助,你可以帮作者买一杯咖啡表示支持! ![donate](https://unpkg.com/@vbenjs/static-source@0.1.7/source/sponsor.png) Paypal Me -## Contributor +## 贡献者 - Contributors + Contributors ## Discord - [Github Discussions](https://github.com/anncwb/vue-vben-admin/discussions) -## License +## 许可证 [MIT © Vben-2020](./LICENSE) diff --git a/apps/backend-mock/api/upload.ts b/apps/backend-mock/api/upload.ts new file mode 100644 index 00000000000..1bb9e602d6b --- /dev/null +++ b/apps/backend-mock/api/upload.ts @@ -0,0 +1,13 @@ +import { verifyAccessToken } from '~/utils/jwt-utils'; +import { unAuthorizedResponse } from '~/utils/response'; + +export default eventHandler((event) => { + const userinfo = verifyAccessToken(event); + if (!userinfo) { + return unAuthorizedResponse(event); + } + return useResponseSuccess({ + url: 'https://unpkg.com/@vbenjs/static-source@0.1.7/source/logo-v1.webp', + }); + // return useResponseError("test") +}); diff --git a/apps/backend-mock/routes/[...].ts b/apps/backend-mock/routes/[...].ts index 70c5f7c745d..99f544b6616 100644 --- a/apps/backend-mock/routes/[...].ts +++ b/apps/backend-mock/routes/[...].ts @@ -7,6 +7,7 @@ export default defineEventHandler(() => {
  • /api/menu/all
  • /api/auth/codes
  • /api/auth/login
  • +
  • /api/upload
  • `; }); diff --git a/apps/web-antd/.env b/apps/web-antd/.env index c14a467fb00..19735f36fda 100644 --- a/apps/web-antd/.env +++ b/apps/web-antd/.env @@ -3,3 +3,6 @@ VITE_APP_TITLE=Vben Admin Antd # 应用命名空间,用于缓存、store等功能的前缀,确保隔离 VITE_APP_NAMESPACE=vben-web-antd + +# 对store进行加密的密钥,在将store持久化到localStorage时会使用该密钥进行加密 +VITE_APP_STORE_SECURE_KEY=please-replace-me-with-your-own-key diff --git a/apps/web-antd/package.json b/apps/web-antd/package.json index ca88bf1acb9..bb5ab7e12df 100644 --- a/apps/web-antd/package.json +++ b/apps/web-antd/package.json @@ -1,6 +1,6 @@ { "name": "@vben/web-antd", - "version": "5.5.4", + "version": "5.5.6", "homepage": "https://vben.pro", "bugs": "https://github.com/vbenjs/vue-vben-admin/issues", "repository": { diff --git a/apps/web-antd/src/adapter/component/index.ts b/apps/web-antd/src/adapter/component/index.ts index 5394c8130f4..d452d521060 100644 --- a/apps/web-antd/src/adapter/component/index.ts +++ b/apps/web-antd/src/adapter/component/index.ts @@ -73,8 +73,8 @@ const withDefaultPlaceholder = ( componentProps: Recordable = {}, ) => { return defineComponent({ - inheritAttrs: false, name: component.name, + inheritAttrs: false, setup: (props: any, { attrs, expose, slots }) => { const placeholder = props?.placeholder || @@ -136,20 +136,34 @@ async function initComponentAdapter() { // 如果你的组件体积比较大,可以使用异步加载 // Button: () => // import('xxx').then((res) => res.Button), - ApiSelect: withDefaultPlaceholder(ApiComponent, 'select', { - component: Select, - loadingSlot: 'suffixIcon', - visibleEvent: 'onDropdownVisibleChange', - modelPropName: 'value', - }), - ApiTreeSelect: withDefaultPlaceholder(ApiComponent, 'select', { - component: TreeSelect, - fieldNames: { label: 'label', value: 'value', children: 'children' }, - loadingSlot: 'suffixIcon', - modelPropName: 'value', - optionsPropName: 'treeData', - visibleEvent: 'onVisibleChange', - }), + ApiSelect: withDefaultPlaceholder( + { + ...ApiComponent, + name: 'ApiSelect', + }, + 'select', + { + component: Select, + loadingSlot: 'suffixIcon', + visibleEvent: 'onDropdownVisibleChange', + modelPropName: 'value', + }, + ), + ApiTreeSelect: withDefaultPlaceholder( + { + ...ApiComponent, + name: 'ApiTreeSelect', + }, + 'select', + { + component: TreeSelect, + fieldNames: { label: 'label', value: 'value', children: 'children' }, + loadingSlot: 'suffixIcon', + modelPropName: 'value', + optionsPropName: 'treeData', + visibleEvent: 'onVisibleChange', + }, + ), AutoComplete, Checkbox, CheckboxGroup, diff --git a/apps/web-antd/src/router/guard.ts b/apps/web-antd/src/router/guard.ts index cbb5235ec77..a1ad6d88cff 100644 --- a/apps/web-antd/src/router/guard.ts +++ b/apps/web-antd/src/router/guard.ts @@ -1,6 +1,6 @@ import type { Router } from 'vue-router'; -import { DEFAULT_HOME_PATH, LOGIN_PATH } from '@vben/constants'; +import { LOGIN_PATH } from '@vben/constants'; import { preferences } from '@vben/preferences'; import { useAccessStore, useUserStore } from '@vben/stores'; import { startProgress, stopProgress } from '@vben/utils'; @@ -18,7 +18,7 @@ function setupCommonGuard(router: Router) { // 记录已经加载的页面 const loadedPaths = new Set(); - router.beforeEach(async (to) => { + router.beforeEach((to) => { to.meta.loaded = loadedPaths.has(to.path); // 页面加载进度条 @@ -56,7 +56,7 @@ function setupAccessGuard(router: Router) { return decodeURIComponent( (to.query?.redirect as string) || userStore.userInfo?.homePath || - DEFAULT_HOME_PATH, + preferences.app.defaultHomePath, ); } return true; @@ -75,7 +75,7 @@ function setupAccessGuard(router: Router) { path: LOGIN_PATH, // 如不需要,直接删除 query query: - to.fullPath === DEFAULT_HOME_PATH + to.fullPath === preferences.app.defaultHomePath ? {} : { redirect: encodeURIComponent(to.fullPath) }, // 携带当前跳转的页面,登录后重新跳转该页面 @@ -108,8 +108,8 @@ function setupAccessGuard(router: Router) { accessStore.setAccessRoutes(accessibleRoutes); accessStore.setIsAccessChecked(true); const redirectPath = (from.query.redirect ?? - (to.path === DEFAULT_HOME_PATH - ? userInfo.homePath || DEFAULT_HOME_PATH + (to.path === preferences.app.defaultHomePath + ? userInfo.homePath || preferences.app.defaultHomePath : to.fullPath)) as string; return { diff --git a/apps/web-antd/src/router/routes/core.ts b/apps/web-antd/src/router/routes/core.ts index 4a527a311da..949b0b65acf 100644 --- a/apps/web-antd/src/router/routes/core.ts +++ b/apps/web-antd/src/router/routes/core.ts @@ -1,6 +1,7 @@ import type { RouteRecordRaw } from 'vue-router'; -import { DEFAULT_HOME_PATH, LOGIN_PATH } from '@vben/constants'; +import { LOGIN_PATH } from '@vben/constants'; +import { preferences } from '@vben/preferences'; import { $t } from '#/locales'; @@ -34,7 +35,7 @@ const coreRoutes: RouteRecordRaw[] = [ }, name: 'Root', path: '/', - redirect: DEFAULT_HOME_PATH, + redirect: preferences.app.defaultHomePath, children: [], }, { diff --git a/apps/web-antd/src/store/auth.ts b/apps/web-antd/src/store/auth.ts index 9d64d205879..bd496d1ee41 100644 --- a/apps/web-antd/src/store/auth.ts +++ b/apps/web-antd/src/store/auth.ts @@ -3,7 +3,8 @@ import type { Recordable, UserInfo } from '@vben/types'; import { ref } from 'vue'; import { useRouter } from 'vue-router'; -import { DEFAULT_HOME_PATH, LOGIN_PATH } from '@vben/constants'; +import { LOGIN_PATH } from '@vben/constants'; +import { preferences } from '@vben/preferences'; import { resetAllStores, useAccessStore, useUserStore } from '@vben/stores'; import { notification } from 'ant-design-vue'; @@ -54,7 +55,9 @@ export const useAuthStore = defineStore('auth', () => { } else { onSuccess ? await onSuccess?.() - : await router.push(userInfo.homePath || DEFAULT_HOME_PATH); + : await router.push( + userInfo.homePath || preferences.app.defaultHomePath, + ); } if (userInfo?.realName) { diff --git a/apps/web-ele/.env b/apps/web-ele/.env index 87cb3df1458..bb57c865130 100644 --- a/apps/web-ele/.env +++ b/apps/web-ele/.env @@ -3,3 +3,6 @@ VITE_APP_TITLE=Vben Admin Ele # 应用命名空间,用于缓存、store等功能的前缀,确保隔离 VITE_APP_NAMESPACE=vben-web-ele + +# 对store进行加密的密钥,在将store持久化到localStorage时会使用该密钥进行加密 +VITE_APP_STORE_SECURE_KEY=please-replace-me-with-your-own-key diff --git a/apps/web-ele/package.json b/apps/web-ele/package.json index 7b90f172fee..a51f5a9b662 100644 --- a/apps/web-ele/package.json +++ b/apps/web-ele/package.json @@ -1,6 +1,6 @@ { "name": "@vben/web-ele", - "version": "5.5.4", + "version": "5.5.6", "homepage": "https://vben.pro", "bugs": "https://github.com/vbenjs/vue-vben-admin/issues", "repository": { diff --git a/apps/web-ele/src/adapter/component/index.ts b/apps/web-ele/src/adapter/component/index.ts index cf7340a2dfe..e2f533cf527 100644 --- a/apps/web-ele/src/adapter/component/index.ts +++ b/apps/web-ele/src/adapter/component/index.ts @@ -130,8 +130,8 @@ const withDefaultPlaceholder = ( componentProps: Recordable = {}, ) => { return defineComponent({ - inheritAttrs: false, name: component.name, + inheritAttrs: false, setup: (props: any, { attrs, expose, slots }) => { const placeholder = props?.placeholder || @@ -184,19 +184,33 @@ async function initComponentAdapter() { // 如果你的组件体积比较大,可以使用异步加载 // Button: () => // import('xxx').then((res) => res.Button), - ApiSelect: withDefaultPlaceholder(ApiComponent, 'select', { - component: ElSelectV2, - loadingSlot: 'loading', - visibleEvent: 'onVisibleChange', - }), - ApiTreeSelect: withDefaultPlaceholder(ApiComponent, 'select', { - component: ElTreeSelect, - props: { label: 'label', children: 'children' }, - nodeKey: 'value', - loadingSlot: 'loading', - optionsPropName: 'data', - visibleEvent: 'onVisibleChange', - }), + ApiSelect: withDefaultPlaceholder( + { + ...ApiComponent, + name: 'ApiSelect', + }, + 'select', + { + component: ElSelectV2, + loadingSlot: 'loading', + visibleEvent: 'onVisibleChange', + }, + ), + ApiTreeSelect: withDefaultPlaceholder( + { + ...ApiComponent, + name: 'ApiTreeSelect', + }, + 'select', + { + component: ElTreeSelect, + props: { label: 'label', children: 'children' }, + nodeKey: 'value', + loadingSlot: 'loading', + optionsPropName: 'data', + visibleEvent: 'onVisibleChange', + }, + ), Checkbox: ElCheckbox, CheckboxGroup: (props, { attrs, slots }) => { let defaultSlot; diff --git a/apps/web-ele/src/router/guard.ts b/apps/web-ele/src/router/guard.ts index cbb5235ec77..a1ad6d88cff 100644 --- a/apps/web-ele/src/router/guard.ts +++ b/apps/web-ele/src/router/guard.ts @@ -1,6 +1,6 @@ import type { Router } from 'vue-router'; -import { DEFAULT_HOME_PATH, LOGIN_PATH } from '@vben/constants'; +import { LOGIN_PATH } from '@vben/constants'; import { preferences } from '@vben/preferences'; import { useAccessStore, useUserStore } from '@vben/stores'; import { startProgress, stopProgress } from '@vben/utils'; @@ -18,7 +18,7 @@ function setupCommonGuard(router: Router) { // 记录已经加载的页面 const loadedPaths = new Set(); - router.beforeEach(async (to) => { + router.beforeEach((to) => { to.meta.loaded = loadedPaths.has(to.path); // 页面加载进度条 @@ -56,7 +56,7 @@ function setupAccessGuard(router: Router) { return decodeURIComponent( (to.query?.redirect as string) || userStore.userInfo?.homePath || - DEFAULT_HOME_PATH, + preferences.app.defaultHomePath, ); } return true; @@ -75,7 +75,7 @@ function setupAccessGuard(router: Router) { path: LOGIN_PATH, // 如不需要,直接删除 query query: - to.fullPath === DEFAULT_HOME_PATH + to.fullPath === preferences.app.defaultHomePath ? {} : { redirect: encodeURIComponent(to.fullPath) }, // 携带当前跳转的页面,登录后重新跳转该页面 @@ -108,8 +108,8 @@ function setupAccessGuard(router: Router) { accessStore.setAccessRoutes(accessibleRoutes); accessStore.setIsAccessChecked(true); const redirectPath = (from.query.redirect ?? - (to.path === DEFAULT_HOME_PATH - ? userInfo.homePath || DEFAULT_HOME_PATH + (to.path === preferences.app.defaultHomePath + ? userInfo.homePath || preferences.app.defaultHomePath : to.fullPath)) as string; return { diff --git a/apps/web-ele/src/router/routes/core.ts b/apps/web-ele/src/router/routes/core.ts index 4a527a311da..949b0b65acf 100644 --- a/apps/web-ele/src/router/routes/core.ts +++ b/apps/web-ele/src/router/routes/core.ts @@ -1,6 +1,7 @@ import type { RouteRecordRaw } from 'vue-router'; -import { DEFAULT_HOME_PATH, LOGIN_PATH } from '@vben/constants'; +import { LOGIN_PATH } from '@vben/constants'; +import { preferences } from '@vben/preferences'; import { $t } from '#/locales'; @@ -34,7 +35,7 @@ const coreRoutes: RouteRecordRaw[] = [ }, name: 'Root', path: '/', - redirect: DEFAULT_HOME_PATH, + redirect: preferences.app.defaultHomePath, children: [], }, { diff --git a/apps/web-ele/src/store/auth.ts b/apps/web-ele/src/store/auth.ts index 639fb037236..74fadfe2479 100644 --- a/apps/web-ele/src/store/auth.ts +++ b/apps/web-ele/src/store/auth.ts @@ -3,7 +3,8 @@ import type { Recordable, UserInfo } from '@vben/types'; import { ref } from 'vue'; import { useRouter } from 'vue-router'; -import { DEFAULT_HOME_PATH, LOGIN_PATH } from '@vben/constants'; +import { LOGIN_PATH } from '@vben/constants'; +import { preferences } from '@vben/preferences'; import { resetAllStores, useAccessStore, useUserStore } from '@vben/stores'; import { ElNotification } from 'element-plus'; @@ -55,7 +56,9 @@ export const useAuthStore = defineStore('auth', () => { } else { onSuccess ? await onSuccess?.() - : await router.push(userInfo.homePath || DEFAULT_HOME_PATH); + : await router.push( + userInfo.homePath || preferences.app.defaultHomePath, + ); } if (userInfo?.realName) { diff --git a/apps/web-ele/src/views/demos/form/basic.vue b/apps/web-ele/src/views/demos/form/basic.vue index 771665a6604..0ecab58643e 100644 --- a/apps/web-ele/src/views/demos/form/basic.vue +++ b/apps/web-ele/src/views/demos/form/basic.vue @@ -1,7 +1,7 @@ ``` + +## 标签页与路由控制 + +在某些场景下,需要单个路由打开多个标签页,或者修改路由的query不打开新的标签页 + +每个标签页Tab使用唯一的key标识,设置Tab key有三种方式,优先级由高到低: + +- 使用路由query参数pageKey + +```vue + diff --git a/packages/@core/ui-kit/layout-ui/package.json b/packages/@core/ui-kit/layout-ui/package.json index 0f26fa31c1d..d62d18646d6 100644 --- a/packages/@core/ui-kit/layout-ui/package.json +++ b/packages/@core/ui-kit/layout-ui/package.json @@ -1,6 +1,6 @@ { "name": "@vben-core/layout-ui", - "version": "5.5.4", + "version": "5.5.6", "homepage": "https://github.com/vbenjs/vue-vben-admin", "bugs": "https://github.com/vbenjs/vue-vben-admin/issues", "repository": { diff --git a/packages/@core/ui-kit/layout-ui/src/components/layout-header.vue b/packages/@core/ui-kit/layout-ui/src/components/layout-header.vue index 534e4162cfe..a58e9de85aa 100644 --- a/packages/@core/ui-kit/layout-ui/src/components/layout-header.vue +++ b/packages/@core/ui-kit/layout-ui/src/components/layout-header.vue @@ -64,7 +64,7 @@ const logoStyle = computed((): CSSProperties => {
    @@ -75,3 +75,17 @@ const logoStyle = computed((): CSSProperties => {
    + diff --git a/packages/@core/ui-kit/menu-ui/package.json b/packages/@core/ui-kit/menu-ui/package.json index f44097b4e31..1ff5741c7c7 100644 --- a/packages/@core/ui-kit/menu-ui/package.json +++ b/packages/@core/ui-kit/menu-ui/package.json @@ -1,6 +1,6 @@ { "name": "@vben-core/menu-ui", - "version": "5.5.4", + "version": "5.5.6", "homepage": "https://github.com/vbenjs/vue-vben-admin", "bugs": "https://github.com/vbenjs/vue-vben-admin/issues", "repository": { diff --git a/packages/@core/ui-kit/menu-ui/src/components/menu.vue b/packages/@core/ui-kit/menu-ui/src/components/menu.vue index 7a7370088e8..88760456747 100644 --- a/packages/@core/ui-kit/menu-ui/src/components/menu.vue +++ b/packages/@core/ui-kit/menu-ui/src/components/menu.vue @@ -31,6 +31,7 @@ import { createSubMenuContext, useMenuStyle, } from '../hooks'; +import { useMenuScroll } from '../hooks/use-menu-scroll'; import { flattedChildren } from '../utils'; import SubMenu from './sub-menu.vue'; @@ -44,6 +45,7 @@ const props = withDefaults(defineProps(), { mode: 'vertical', rounded: true, theme: 'dark', + scrollToActive: false, }); const emit = defineEmits<{ @@ -206,15 +208,19 @@ function handleResize() { isFirstTimeRender = false; } -function getActivePaths() { - const activeItem = activePath.value && items.value[activePath.value]; +const enableScroll = computed( + () => props.scrollToActive && props.mode === 'vertical' && !props.collapse, +); - if (!activeItem || props.mode === 'horizontal' || props.collapse) { - return []; - } +const { scrollToActiveItem } = useMenuScroll(activePath, { + enable: enableScroll, + delay: 320, +}); - return activeItem.parentPaths; -} +// 监听 activePath 变化,自动滚动到激活项 +watch(activePath, () => { + scrollToActiveItem(); +}); // 默认展开菜单 function initMenu() { @@ -318,6 +324,16 @@ function removeSubMenu(subMenu: MenuItemRegistered) { function removeMenuItem(item: MenuItemRegistered) { Reflect.deleteProperty(items.value, item.path); } + +function getActivePaths() { + const activeItem = activePath.value && items.value[activePath.value]; + + if (!activeItem || props.mode === 'horizontal' || props.collapse) { + return []; + } + + return activeItem.parentPaths; +}