Skip to content

Commit

Permalink
Merge branch 'vbenjs:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
ORACLE128G authored Nov 6, 2024
2 parents 94cca0f + 488ccb5 commit 23295f8
Show file tree
Hide file tree
Showing 72 changed files with 1,938 additions and 2,243 deletions.
1 change: 1 addition & 0 deletions apps/backend-mock/nitro.config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import errorHandler from './error';

process.env.COMPATIBILITY_DATE = new Date().toISOString();
export default defineNitroConfig({
devErrorHandler: errorHandler,
errorHandler: '~/error',
Expand Down
2 changes: 1 addition & 1 deletion apps/web-antd/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@vben/web-antd",
"version": "5.4.3",
"version": "5.4.4",
"homepage": "https://vben.pro",
"bugs": "https://github.com/vbenjs/vue-vben-admin/issues",
"repository": {
Expand Down
4 changes: 2 additions & 2 deletions apps/web-antd/src/adapter/vxe-table.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,15 @@ setupVbenVxeTable({

// 表格配置项可以用 cellRender: { name: 'CellImage' },
vxeUI.renderer.add('CellImage', {
renderDefault(_renderOpts, params) {
renderTableDefault(_renderOpts, params) {
const { column, row } = params;
return h(Image, { src: row[column.field] });
},
});

// 表格配置项可以用 cellRender: { name: 'CellLink' },
vxeUI.renderer.add('CellLink', {
renderDefault(renderOpts) {
renderTableDefault(renderOpts) {
const { props } = renderOpts;
return h(
Button,
Expand Down
17 changes: 15 additions & 2 deletions apps/web-antd/src/bootstrap.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
import { createApp } from 'vue';
import { createApp, watchEffect } from 'vue';

import { registerAccessDirective } from '@vben/access';
import { preferences } from '@vben/preferences';
import { initStores } from '@vben/stores';
import '@vben/styles';
import '@vben/styles/antd';

import { setupI18n } from '#/locales';
import { useTitle } from '@vueuse/core';

import { $t, setupI18n } from '#/locales';

import { initComponentAdapter } from './adapter/component';
import App from './app.vue';
Expand All @@ -29,6 +32,16 @@ async function bootstrap(namespace: string) {
// 配置路由及路由守卫
app.use(router);

// 动态更新标题
watchEffect(() => {
if (preferences.app.dynamicTitle) {
const routeTitle = router.currentRoute.value.meta?.title;
const pageTitle =
(routeTitle ? `${$t(routeTitle)} - ` : '') + preferences.app.name;
useTitle(pageTitle);
}
});

app.mount('#app');
}

Expand Down
10 changes: 0 additions & 10 deletions apps/web-antd/src/router/guard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@ import { preferences } from '@vben/preferences';
import { useAccessStore, useUserStore } from '@vben/stores';
import { startProgress, stopProgress } from '@vben/utils';

import { useTitle } from '@vueuse/core';

import { $t } from '#/locales';
import { accessRoutes, coreRouteNames } from '#/router/routes';
import { useAuthStore } from '#/store';

Expand Down Expand Up @@ -40,13 +37,6 @@ function setupCommonGuard(router: Router) {
if (preferences.transition.progress) {
stopProgress();
}

// 动态修改标题
if (preferences.app.dynamicTitle) {
const { title } = to.meta;
// useTitle(`${$t(title)} - ${preferences.app.name}`);
useTitle(`${$t(title)} - ${preferences.app.name}`);
}
});
}

Expand Down
2 changes: 1 addition & 1 deletion apps/web-ele/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@vben/web-ele",
"version": "5.4.3",
"version": "5.4.4",
"homepage": "https://vben.pro",
"bugs": "https://github.com/vbenjs/vue-vben-admin/issues",
"repository": {
Expand Down
4 changes: 2 additions & 2 deletions apps/web-ele/src/adapter/vxe-table.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ setupVbenVxeTable({

// 表格配置项可以用 cellRender: { name: 'CellImage' },
vxeUI.renderer.add('CellImage', {
renderDefault(_renderOpts, params) {
renderTableDefault(_renderOpts, params) {
const { column, row } = params;
const src = row[column.field];
return h(ElImage, { src, previewSrcList: [src] });
Expand All @@ -47,7 +47,7 @@ setupVbenVxeTable({

// 表格配置项可以用 cellRender: { name: 'CellLink' },
vxeUI.renderer.add('CellLink', {
renderDefault(renderOpts) {
renderTableDefault(renderOpts) {
const { props } = renderOpts;
return h(
ElButton,
Expand Down
17 changes: 15 additions & 2 deletions apps/web-ele/src/bootstrap.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
import { createApp } from 'vue';
import { createApp, watchEffect } from 'vue';

import { registerAccessDirective } from '@vben/access';
import { preferences } from '@vben/preferences';
import { initStores } from '@vben/stores';
import '@vben/styles';
import '@vben/styles/ele';

import { setupI18n } from '#/locales';
import { useTitle } from '@vueuse/core';

import { $t, setupI18n } from '#/locales';

import { initComponentAdapter } from './adapter/component';
import App from './app.vue';
Expand All @@ -28,6 +31,16 @@ async function bootstrap(namespace: string) {
// 配置路由及路由守卫
app.use(router);

// 动态更新标题
watchEffect(() => {
if (preferences.app.dynamicTitle) {
const routeTitle = router.currentRoute.value.meta?.title;
const pageTitle =
(routeTitle ? `${$t(routeTitle)} - ` : '') + preferences.app.name;
useTitle(pageTitle);
}
});

app.mount('#app');
}

Expand Down
10 changes: 0 additions & 10 deletions apps/web-ele/src/router/guard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@ import { preferences } from '@vben/preferences';
import { useAccessStore, useUserStore } from '@vben/stores';
import { startProgress, stopProgress } from '@vben/utils';

import { useTitle } from '@vueuse/core';

import { $t } from '#/locales';
import { accessRoutes, coreRouteNames } from '#/router/routes';
import { useAuthStore } from '#/store';

Expand Down Expand Up @@ -40,13 +37,6 @@ function setupCommonGuard(router: Router) {
if (preferences.transition.progress) {
stopProgress();
}

// 动态修改标题
if (preferences.app.dynamicTitle) {
const { title } = to.meta;
// useTitle(`${$t(title)} - ${preferences.app.name}`);
useTitle(`${$t(title)} - ${preferences.app.name}`);
}
});
}

Expand Down
2 changes: 1 addition & 1 deletion apps/web-naive/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@vben/web-naive",
"version": "5.4.3",
"version": "5.4.4",
"homepage": "https://vben.pro",
"bugs": "https://github.com/vbenjs/vue-vben-admin/issues",
"repository": {
Expand Down
4 changes: 2 additions & 2 deletions apps/web-naive/src/adapter/vxe-table.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,15 @@ setupVbenVxeTable({

// 表格配置项可以用 cellRender: { name: 'CellImage' },
vxeUI.renderer.add('CellImage', {
renderDefault(_renderOpts, params) {
renderTableDefault(_renderOpts, params) {
const { column, row } = params;
return h(NImage, { src: row[column.field] });
},
});

// 表格配置项可以用 cellRender: { name: 'CellLink' },
vxeUI.renderer.add('CellLink', {
renderDefault(renderOpts) {
renderTableDefault(renderOpts) {
const { props } = renderOpts;
return h(
NButton,
Expand Down
17 changes: 15 additions & 2 deletions apps/web-naive/src/bootstrap.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
import { createApp } from 'vue';
import { createApp, watchEffect } from 'vue';

import { registerAccessDirective } from '@vben/access';
import { preferences } from '@vben/preferences';
import { initStores } from '@vben/stores';
import '@vben/styles';

import { setupI18n } from '#/locales';
import { useTitle } from '@vueuse/core';

import { $t, setupI18n } from '#/locales';

import { initComponentAdapter } from './adapter/component';
import App from './app.vue';
Expand All @@ -27,6 +30,16 @@ async function bootstrap(namespace: string) {
// 配置路由及路由守卫
app.use(router);

// 动态更新标题
watchEffect(() => {
if (preferences.app.dynamicTitle) {
const routeTitle = router.currentRoute.value.meta?.title;
const pageTitle =
(routeTitle ? `${$t(routeTitle)} - ` : '') + preferences.app.name;
useTitle(pageTitle);
}
});

app.mount('#app');
}

Expand Down
10 changes: 0 additions & 10 deletions apps/web-naive/src/router/guard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@ import { preferences } from '@vben/preferences';
import { useAccessStore, useUserStore } from '@vben/stores';
import { startProgress, stopProgress } from '@vben/utils';

import { useTitle } from '@vueuse/core';

import { $t } from '#/locales';
import { accessRoutes, coreRouteNames } from '#/router/routes';
import { useAuthStore } from '#/store';

Expand Down Expand Up @@ -40,13 +37,6 @@ function setupCommonGuard(router: Router) {
if (preferences.transition.progress) {
stopProgress();
}

// 动态修改标题
if (preferences.app.dynamicTitle) {
const { title } = to.meta;
// useTitle(`${$t(title)} - ${preferences.app.name}`);
useTitle(`${$t(title)} - ${preferences.app.name}`);
}
});
}

Expand Down
2 changes: 1 addition & 1 deletion docs/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@vben/docs",
"version": "5.4.3",
"version": "5.4.4",
"private": true,
"scripts": {
"build": "vitepress build",
Expand Down
6 changes: 6 additions & 0 deletions docs/src/en/guide/essentials/development.md
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,12 @@ To run the `docs` application:
pnpm dev:docs
```

## Public Static Resources

If you need to use public static resources in the project, such as images, static HTML, etc., and you want to directly import them in the development process through `src="/xxx.png"`.

You need to put the resource in the corresponding project's `public/static` directory. The import path for the resource should be `src="/static/xxx.png"`.

## DevTools

The project has a built-in [Vue DevTools](https://github.com/vuejs/devtools-next) plugin, which can be used during development. It is disabled by default, but can be enabled in the `.env.development` file. After enabling it, restart the project:
Expand Down
2 changes: 1 addition & 1 deletion docs/src/en/guide/introduction/quick-start.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ outline: deep

Before starting the project, ensure that your environment meets the following requirements:

- [Node.js](https://nodejs.org/en) version 20 or above. It is recommended to use [fnm](https://github.com/Schniz/fnm) or [nvm](https://github.com/nvm-sh/nvm) for version management.
- [Node.js](https://nodejs.org/en) version 20.15.0 or above. It is recommended to use [fnm](https://github.com/Schniz/fnm), [nvm](https://github.com/nvm-sh/nvm), or directly use [pnpm](https://pnpm.io/cli/env) for version management.
- [Git](https://git-scm.com/) any version.

To verify if your environment meets the above requirements, you can check the versions using the following commands:
Expand Down
6 changes: 6 additions & 0 deletions docs/src/guide/essentials/development.md
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,12 @@ pnpm dev:ele
pnpm dev:docs
```

## 公共静态资源

项目中需要使用到的公共静态资源,如:图片、静态HTML等,需要在开发中通过 `src="/xxx.png"` 直接引入的。

需要将资源放在对应项目的 `public/static` 目录下。引入的路径为:`src="/static/xxx.png"`

## DevTools

项目内置了 [Vue DevTools](https://github.com/vuejs/devtools-next) 插件,可以在开发过程中使用。默认关闭,可在`.env.development` 内开启,并重新运行项目即可:
Expand Down
2 changes: 1 addition & 1 deletion docs/src/guide/in-depth/loading.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

## 原理

`vite-plugin-inject-app-loading` 插件实现,插件会在每个应用的注入一个全局的 `loading html`
`vite-plugin-inject-app-loading` 插件实现,插件会在每个应用都注入一个全局的 `loading html`

## 关闭

Expand Down
2 changes: 1 addition & 1 deletion docs/src/guide/introduction/quick-start.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ outline: deep

在启动项目前,你需要确保你的环境满足以下要求:

- [Node.js](https://nodejs.org/en) 20.15.0 及以上版本,推荐使用 [fnm](https://github.com/Schniz/fnm) 或者 [nvm](https://github.com/nvm-sh/nvm) 进行版本管理。
- [Node.js](https://nodejs.org/en) 20.15.0 及以上版本,推荐使用 [fnm](https://github.com/Schniz/fnm) [nvm](https://github.com/nvm-sh/nvm) 或者直接使用[pnpm](https://pnpm.io/cli/env) 进行版本管理。
- [Git](https://git-scm.com/) 任意版本。

验证你的环境是否满足以上要求,你可以通过以下命令查看版本:
Expand Down
2 changes: 1 addition & 1 deletion internal/lint-configs/commitlint-config/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@vben/commitlint-config",
"version": "5.4.3",
"version": "5.4.4",
"private": true,
"homepage": "https://github.com/vbenjs/vue-vben-admin",
"bugs": "https://github.com/vbenjs/vue-vben-admin/issues",
Expand Down
2 changes: 1 addition & 1 deletion internal/lint-configs/stylelint-config/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@vben/stylelint-config",
"version": "5.4.3",
"version": "5.4.4",
"private": true,
"homepage": "https://github.com/vbenjs/vue-vben-admin",
"bugs": "https://github.com/vbenjs/vue-vben-admin/issues",
Expand Down
2 changes: 1 addition & 1 deletion internal/node-utils/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@vben/node-utils",
"version": "5.4.3",
"version": "5.4.4",
"private": true,
"homepage": "https://github.com/vbenjs/vue-vben-admin",
"bugs": "https://github.com/vbenjs/vue-vben-admin/issues",
Expand Down
1 change: 0 additions & 1 deletion internal/tailwind-config/build.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ export default defineBuildConfig({
clean: true,
declaration: true,
entries: ['src/index', './src/postcss.config'],
externals: ['@vben/node-utils'],
rollup: {
emitCJS: true,
},
Expand Down
8 changes: 4 additions & 4 deletions internal/tailwind-config/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@vben/tailwind-config",
"version": "5.4.3",
"version": "5.4.4",
"private": true,
"homepage": "https://github.com/vbenjs/vue-vben-admin",
"bugs": "https://github.com/vbenjs/vue-vben-admin/issues",
Expand All @@ -12,7 +12,7 @@
"license": "MIT",
"type": "module",
"scripts": {
"stub": "pnpm unbuild --stub"
"stub": "pnpm unbuild"
},
"files": [
"dist"
Expand Down Expand Up @@ -48,6 +48,7 @@
"dependencies": {
"@iconify/json": "catalog:",
"@iconify/tailwind": "catalog:",
"@manypkg/get-packages": "catalog:",
"@tailwindcss/nesting": "catalog:",
"@tailwindcss/typography": "catalog:",
"autoprefixer": "catalog:",
Expand All @@ -60,7 +61,6 @@
"tailwindcss-animate": "catalog:"
},
"devDependencies": {
"@types/postcss-import": "catalog:",
"@vben/node-utils": "workspace:*"
"@types/postcss-import": "catalog:"
}
}
Loading

0 comments on commit 23295f8

Please sign in to comment.