Skip to content

Commit

Permalink
fix(form): fix the problem of form props monitoring close #322
Browse files Browse the repository at this point in the history
  • Loading branch information
anncwb committed Mar 4, 2021
1 parent ce93e46 commit 83a3460
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 5 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.zh_CN.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
## Wip

### 🐛 Bug Fixes

- 修复`Description`已知问题
- 修复`BasicForm`已知问题

## 2.0.2 (2021-03-04)

### ✨ Refactor
Expand Down
16 changes: 11 additions & 5 deletions src/components/Form/src/hooks/useForm.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ref, onUnmounted, unref, nextTick, watchEffect } from 'vue';
import { ref, onUnmounted, unref, nextTick, watch } from 'vue';

import { isInSetup } from '/@/utils/helper/vueHelper';
import { isProdMode } from '/@/utils/env';
Expand Down Expand Up @@ -39,12 +39,18 @@ export function useForm(props?: Props): UseFormReturnType {
if (unref(loadedRef) && isProdMode() && instance === unref(formRef)) return;

formRef.value = instance;

loadedRef.value = true;

watchEffect(() => {
props && instance.setProps(getDynamicProps(props));
});
watch(
() => props,
() => {
props && instance.setProps(getDynamicProps(props));
},
{
immediate: true,
deep: true,
}
);
}

const methods: FormActionType = {
Expand Down

0 comments on commit 83a3460

Please sign in to comment.