Merge remote-tracking branch 'yudao/dev' into dev
commit
9ceb1cc63c
|
@ -21,7 +21,7 @@ The rules are consistent with [Vite Env Variables and Modes](https://vitejs.dev/
|
||||||
console.log(import.meta.env.VITE_PROT);
|
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<string, any>,
|
||||||
|
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.
|
At this point, you can use the `useAppConfig` method within the project to access the newly added configuration item.
|
||||||
|
|
||||||
```ts
|
```ts
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
console.log(import.meta.env.VITE_PROT);
|
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<string, any>,
|
||||||
|
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`方法获取到新增的配置项了。
|
到这里,就可以在项目内使用 `useAppConfig`方法获取到新增的配置项了。
|
||||||
|
|
||||||
```ts
|
```ts
|
||||||
|
|
|
@ -94,8 +94,9 @@ export function useVbenModal<TParentModalProps extends ModalProps = ModalProps>(
|
||||||
injectData.options?.onOpenChange?.(isOpen);
|
injectData.options?.onOpenChange?.(isOpen);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const onClosed = mergedOptions.onClosed;
|
||||||
mergedOptions.onClosed = () => {
|
mergedOptions.onClosed = () => {
|
||||||
options.onClosed?.();
|
onClosed?.();
|
||||||
if (mergedOptions.destroyOnClose) {
|
if (mergedOptions.destroyOnClose) {
|
||||||
injectData.reCreateModal?.();
|
injectData.reCreateModal?.();
|
||||||
}
|
}
|
||||||
|
|
|
@ -278,6 +278,15 @@ const delegatedFormSlots = computed(() => {
|
||||||
return resultSlots.map((key) => key.replace(FORM_SLOT_PREFIX, ''));
|
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() {
|
async function init() {
|
||||||
await nextTick();
|
await nextTick();
|
||||||
const globalGridConfig = VxeUI?.getConfig()?.grid ?? {};
|
const globalGridConfig = VxeUI?.getConfig()?.grid ?? {};
|
||||||
|
@ -459,7 +468,7 @@ onUnmounted(() => {
|
||||||
</slot>
|
</slot>
|
||||||
</template>
|
</template>
|
||||||
<!-- 统一控状态 -->
|
<!-- 统一控状态 -->
|
||||||
<template #empty>
|
<template v-if="showDefaultEmpty" #empty>
|
||||||
<slot name="empty">
|
<slot name="empty">
|
||||||
<EmptyIcon class="mx-auto" />
|
<EmptyIcon class="mx-auto" />
|
||||||
<div class="mt-2">{{ $t('common.noData') }}</div>
|
<div class="mt-2">{{ $t('common.noData') }}</div>
|
||||||
|
|
|
@ -105,11 +105,16 @@ function setupAccessGuard(router: Router) {
|
||||||
accessStore.setAccessMenus(accessibleMenus);
|
accessStore.setAccessMenus(accessibleMenus);
|
||||||
accessStore.setAccessRoutes(accessibleRoutes);
|
accessStore.setAccessRoutes(accessibleRoutes);
|
||||||
accessStore.setIsAccessChecked(true);
|
accessStore.setIsAccessChecked(true);
|
||||||
const redirectPath = (from.query.redirect ??
|
let redirectPath: string;
|
||||||
(to.path === preferences.app.defaultHomePath
|
if (from.query.redirect) {
|
||||||
? userInfo.homePath || preferences.app.defaultHomePath
|
redirectPath = from.query.redirect as string;
|
||||||
: to.fullPath)) 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 {
|
return {
|
||||||
...router.resolve(decodeURIComponent(redirectPath)),
|
...router.resolve(decodeURIComponent(redirectPath)),
|
||||||
replace: true,
|
replace: true,
|
||||||
|
|
Loading…
Reference in New Issue