Skip to content

Commit

Permalink
fix: when the form is opened repeatedly, the state is unexpectedly de…
Browse files Browse the repository at this point in the history
…stroyed (#4406)
  • Loading branch information
anncwb committed Sep 14, 2024
1 parent c3d0102 commit 02c4014
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/@core/ui-kit/form-ui/src/form-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ export class FormApi {
}

unmounted() {
this.state = null;
// this.state = null;
this.isMounted = false;
this.stateHandler.reset();
}
Expand Down
7 changes: 7 additions & 0 deletions playground/src/views/examples/modal/form-model-demo.vue
Original file line number Diff line number Diff line change
@@ -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',
Expand Down

0 comments on commit 02c4014

Please sign in to comment.