perf: improve destroyOnClose for VbenDrawer&VbenModal (#6051)

* fix: fix that the default value of modal destroyOnClose does not take effect

* perf: improve destroyOnClose for VbenDrawer
This commit is contained in:
ming4762
2025-04-27 11:26:50 +08:00
committed by GitHub
parent 0a9fc4e02d
commit 0cc1cb5a7b
5 changed files with 64 additions and 11 deletions

View File

@@ -5,9 +5,27 @@ import { useVbenDrawer } from '@vben/common-ui';
import { Input, message } from 'ant-design-vue';
import { useVbenForm } from '#/adapter/form';
const value = ref('');
const [Form] = useVbenForm({
schema: [
{
component: 'Input',
componentProps: {
placeholder: 'KeepAlive测试内部组件',
},
fieldName: 'field1',
hideLabel: true,
label: '字段1',
},
],
showDefaultActions: false,
});
const [Drawer, drawerApi] = useVbenDrawer({
destroyOnClose: false,
onCancel() {
drawerApi.close();
},
@@ -20,7 +38,11 @@ const [Drawer, drawerApi] = useVbenDrawer({
<template>
<Drawer append-to-main title="基础抽屉示例" title-tooltip="标题提示内容">
<template #extra> extra </template>
本抽屉指定在内容区域打开
<Input v-model="value" placeholder="KeepAlive测试" />
此弹窗指定在内容区域打开并且在关闭之后弹窗内容不会被销毁
<Input
v-model:value="value"
placeholder="KeepAlive测试:connectedComponent"
/>
<Form />
</Drawer>
</template>