From 78c3c9da6ffc98d543883b0c3001d86a2422dcb1 Mon Sep 17 00:00:00 2001 From: wyc001122 <498040880@qq.com> Date: Mon, 2 Jun 2025 08:05:23 +0800 Subject: [PATCH 1/7] =?UTF-8?q?docs(settings):=20=E5=AE=8C=E5=96=84'?= =?UTF-8?q?=E7=94=9F=E4=BA=A7=E7=8E=AF=E5=A2=83=E5=8A=A8=E6=80=81=E9=85=8D?= =?UTF-8?q?=E7=BD=AE'=E6=AD=A5=E9=AA=A4=20(#6297)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/src/en/guide/essentials/settings.md | 23 ++++++++++++++++++++++- docs/src/guide/essentials/settings.md | 23 ++++++++++++++++++++++- 2 files changed, 44 insertions(+), 2 deletions(-) diff --git a/docs/src/en/guide/essentials/settings.md b/docs/src/en/guide/essentials/settings.md index e5aa71a8..59a6c5c0 100644 --- a/docs/src/en/guide/essentials/settings.md +++ b/docs/src/en/guide/essentials/settings.md @@ -21,7 +21,7 @@ The rules are consistent with [Vite Env Variables and Modes](https://vitejs.dev/ console.log(import.meta.env.VITE_PROT); ``` -- Variables starting with `VITE_GLOB_*` will be added to the `_app.config.js` configuration file during packaging. ::: +- Variables starting with `VITE_GLOB_*` will be added to the `_app.config.js` configuration file during packaging. ::: @@ -138,6 +138,27 @@ To add a new dynamically modifiable configuration item, simply follow the steps } ``` +- In `packages/effects/hooks/src/use-app-config.ts`, add the corresponding configuration item, such as: + + ```ts + export function useAppConfig( + env: Record, + isProduction: boolean, + ): ApplicationConfig { + // In production environment, directly use the window._VBEN_ADMIN_PRO_APP_CONF_ global variable + const config = isProduction + ? window._VBEN_ADMIN_PRO_APP_CONF_ + : (env as VbenAdminProAppConfigRaw); + + const { VITE_GLOB_API_URL, VITE_GLOB_OTHER_API_URL } = config; // [!code ++] + + return { + apiURL: VITE_GLOB_API_URL, + otherApiURL: VITE_GLOB_OTHER_API_URL, // [!code ++] + }; + } + ``` + At this point, you can use the `useAppConfig` method within the project to access the newly added configuration item. ```ts diff --git a/docs/src/guide/essentials/settings.md b/docs/src/guide/essentials/settings.md index cca572d8..9b47c04d 100644 --- a/docs/src/guide/essentials/settings.md +++ b/docs/src/guide/essentials/settings.md @@ -21,7 +21,7 @@ console.log(import.meta.env.VITE_PROT); ``` -- 以 `VITE_GLOB_*` 开头的的变量,在打包的时候,会被加入 `_app.config.js`配置文件当中. ::: +- 以 `VITE_GLOB_*` 开头的的变量,在打包的时候,会被加入 `_app.config.js`配置文件当中. ::: @@ -137,6 +137,27 @@ const { apiURL } = useAppConfig(import.meta.env, import.meta.env.PROD); } ``` +- 在 `packages/effects/hooks/src/use-app-config.ts` 中,新增对应的配置项,如: + + ```ts + export function useAppConfig( + env: Record, + isProduction: boolean, + ): ApplicationConfig { + // 生产环境下,直接使用 window._VBEN_ADMIN_PRO_APP_CONF_ 全局变量 + const config = isProduction + ? window._VBEN_ADMIN_PRO_APP_CONF_ + : (env as VbenAdminProAppConfigRaw); + + const { VITE_GLOB_API_URL, VITE_GLOB_OTHER_API_URL } = config; // [!code ++] + + return { + apiURL: VITE_GLOB_API_URL, + otherApiURL: VITE_GLOB_OTHER_API_URL, // [!code ++] + }; + } + ``` + 到这里,就可以在项目内使用 `useAppConfig`方法获取到新增的配置项了。 ```ts From 76d106e4742d6f1f260988285711be9d32390811 Mon Sep 17 00:00:00 2001 From: zhang Date: Mon, 2 Jun 2025 08:07:06 +0800 Subject: [PATCH 2/7] =?UTF-8?q?fix:=20=20When=20defaultHomePage=20is=20inc?= =?UTF-8?q?onsistent=20with=20user.homePath,=20the=20pa=E2=80=A6=20(#6299)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix: When defaultHomePage is inconsistent with user.homePath, the page refresh route jump will be abnormal * fix: When defaultHomePage is inconsistent with user.homePath, the page refresh route jump will be abnormal --- playground/src/router/guard.ts | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/playground/src/router/guard.ts b/playground/src/router/guard.ts index 3bbe8dca..514bd2eb 100644 --- a/playground/src/router/guard.ts +++ b/playground/src/router/guard.ts @@ -105,11 +105,16 @@ function setupAccessGuard(router: Router) { accessStore.setAccessMenus(accessibleMenus); accessStore.setAccessRoutes(accessibleRoutes); accessStore.setIsAccessChecked(true); - const redirectPath = (from.query.redirect ?? - (to.path === preferences.app.defaultHomePath - ? userInfo.homePath || preferences.app.defaultHomePath - : to.fullPath)) as string; - + let redirectPath: string; + if (from.query.redirect) { + redirectPath = from.query.redirect as string; + } else if (to.path === preferences.app.defaultHomePath) { + redirectPath = preferences.app.defaultHomePath; + } else if (userInfo.homePath && to.path === userInfo.homePath) { + redirectPath = userInfo.homePath; + } else { + redirectPath = to.fullPath; + } return { ...router.resolve(decodeURIComponent(redirectPath)), replace: true, From 470fd43b4994e8fc4c3cc51b22b859fd430a916e Mon Sep 17 00:00:00 2001 From: wyc001122 <498040880@qq.com> Date: Mon, 2 Jun 2025 08:16:26 +0800 Subject: [PATCH 3/7] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E4=BD=BF=E7=94=A8?= =?UTF-8?q?useVbenVxeGrid=E9=85=8D=E7=BD=AEhasEmptyText=E3=80=81hasEmptyRe?= =?UTF-8?q?nder=E4=B8=8D=E7=94=9F=E6=95=88=E7=9A=84=E9=97=AE=E9=A2=98=20(#?= =?UTF-8?q?6310)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../effects/plugins/src/vxe-table/use-vxe-grid.vue | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/packages/effects/plugins/src/vxe-table/use-vxe-grid.vue b/packages/effects/plugins/src/vxe-table/use-vxe-grid.vue index 72fbb07a..f3eb6735 100644 --- a/packages/effects/plugins/src/vxe-table/use-vxe-grid.vue +++ b/packages/effects/plugins/src/vxe-table/use-vxe-grid.vue @@ -278,6 +278,15 @@ const delegatedFormSlots = computed(() => { return resultSlots.map((key) => key.replace(FORM_SLOT_PREFIX, '')); }); +const showDefaultEmpty = computed(() => { + // 检查是否有原生的 VXE Table 空状态配置 + const hasEmptyText = options.value.emptyText !== undefined; + const hasEmptyRender = options.value.emptyRender !== undefined; + + // 如果有原生配置,就不显示默认的空状态 + return !hasEmptyText && !hasEmptyRender; +}); + async function init() { await nextTick(); const globalGridConfig = VxeUI?.getConfig()?.grid ?? {}; @@ -459,7 +468,7 @@ onUnmounted(() => { -