Commit 02c4014a by Vben Committed by GitHub

fix: when the form is opened repeatedly, the state is unexpectedly destroyed (#4406)

1 parent c3d0102c
......@@ -177,7 +177,7 @@ export class FormApi {
}
unmounted() {
this.state = null;
// this.state = null;
this.isMounted = false;
this.stateHandler.reset();
}
......
<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',
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!