pull/90/MERGE
xingyu4j 2025-05-06 14:39:03 +08:00
commit 703d88d799
4 changed files with 37 additions and 5 deletions

View File

@ -152,10 +152,10 @@ const handleCategorySortSubmit = async () => {
<Page auto-content-height>
<Card
:body-style="{ padding: '10px' }"
class="mb-4"
class="mb-4 h-[89vh]"
v-spinning="modelListSpinning"
>
<div class="flex items-center justify-between pl-5">
<div class="flex h-full items-center justify-between pl-5">
<span class="-mb-4 text-lg font-extrabold">流程模型</span>
<!-- 搜索工作栏 -->
<Form

View File

@ -9,6 +9,7 @@ import {
h,
inject,
nextTick,
onDeactivated,
provide,
reactive,
ref,
@ -70,6 +71,14 @@ export function useVbenDrawer<
inheritAttrs: false,
},
);
/**
* keepAlive /
*/
onDeactivated(() => {
(extendedApi as ExtendedDrawerApi)?.close?.();
});
return [Drawer, extendedApi as ExtendedDrawerApi] as const;
}

View File

@ -1,6 +1,15 @@
import type { ExtendedModalApi, ModalApiOptions, ModalProps } from './modal';
import { defineComponent, h, inject, nextTick, provide, reactive } from 'vue';
import {
defineComponent,
h,
inject,
nextTick,
onDeactivated,
provide,
reactive,
ref,
} from 'vue';
import { useStore } from '@vben-core/shared/store';
@ -24,6 +33,7 @@ export function useVbenModal<TParentModalProps extends ModalProps = ModalProps>(
const { connectedComponent } = options;
if (connectedComponent) {
const extendedApi = reactive({});
const isModalReady = ref(true);
const Modal = defineComponent(
(props: TParentModalProps, { attrs, slots }) => {
provide(USER_MODAL_INJECT_KEY, {
@ -33,6 +43,11 @@ export function useVbenModal<TParentModalProps extends ModalProps = ModalProps>(
Object.setPrototypeOf(extendedApi, api);
},
options,
async reCreateModal() {
isModalReady.value = false;
await nextTick();
isModalReady.value = true;
},
});
checkProps(extendedApi as ExtendedModalApi, {
...props,
@ -41,7 +56,7 @@ export function useVbenModal<TParentModalProps extends ModalProps = ModalProps>(
});
return () =>
h(
connectedComponent,
isModalReady.value ? connectedComponent : 'div',
{
...props,
...attrs,
@ -55,6 +70,14 @@ export function useVbenModal<TParentModalProps extends ModalProps = ModalProps>(
inheritAttrs: false,
},
);
/**
* keepAlive /
*/
onDeactivated(() => {
(extendedApi as ExtendedModalApi)?.close?.();
});
return [Modal, extendedApi as ExtendedModalApi] as const;
}

View File

@ -53,7 +53,7 @@ function generateMenus(
// 处理子菜单
const resultChildren = hideChildrenInMenu
? []
: (children as MenuRecordRaw[]);
: ((children as MenuRecordRaw[]) ?? []);
// 设置子菜单的父子关系
if (resultChildren.length > 0) {