mirror of
https://github.com/vbenjs/vue-vben-admin.git
synced 2025-01-23 01:30:26 +08:00
fix: when the form is opened repeatedly, the state is unexpectedly destroyed (#4406)
This commit is contained in:
parent
c3d0102cda
commit
02c4014ae3
@ -177,7 +177,7 @@ export class FormApi {
|
||||
}
|
||||
|
||||
unmounted() {
|
||||
this.state = null;
|
||||
// this.state = null;
|
||||
this.isMounted = false;
|
||||
this.stateHandler.reset();
|
||||
}
|
||||
|
@ -1,13 +1,20 @@
|
||||
<script lang="ts" setup>
|
||||
import { useVbenModal } from '@vben/common-ui';
|
||||
|
||||
import { message } from 'ant-design-vue';
|
||||
|
||||
import { useVbenForm } from '#/adapter';
|
||||
|
||||
defineOptions({
|
||||
name: 'FormModelDemo',
|
||||
});
|
||||
|
||||
function onSubmit(values: Record<string, any>) {
|
||||
message.info(JSON.stringify(values)); // 只会执行一次
|
||||
}
|
||||
|
||||
const [Form, formApi] = useVbenForm({
|
||||
handleSubmit: onSubmit,
|
||||
schema: [
|
||||
{
|
||||
component: 'Input',
|
||||
|
Loading…
Reference in New Issue
Block a user